Пример #1
0
def disable_module(input_dict, environment_dict):
    """
  <Purpose>
    Disables an enabled module.

  <Arguments>
    input_dict:  The commanddict representing the user's input.
    environment_dict:  The dictionary representing the current seash 
                       environment.

  <Side Effects>
    The module specified in the 'modulename' node will be enabled.

  <Exceptions>
    UserError:
      input_dict did not contain a 'modulename' node, or the user tried to
      disable this module.

  <Returns>
    None
  """

    # Get the modulename
    dict_mark = input_dict
    try:
        command = dict_mark.keys()[0]
        while dict_mark[command]['name'] != 'modulename':
            dict_mark = input_dict[command]['children']
            command = dict_mark.keys()[0]
        modulename = command
    except IndexError:
        raise seash_exceptions.UserError(
            "Error, command requires a modulename")

    if modulename == 'modules':
        raise seash_exceptions.UserError(
            "Error, cannot disable the 'modules' module")

    seash_modules.disable(seash_dictionary.seashcommanddict, modulename)
Пример #2
0
def disable_module(input_dict, environment_dict):
  """
  <Purpose>
    Disables an enabled module.

  <Arguments>
    input_dict:  The commanddict representing the user's input.
    environment_dict:  The dictionary representing the current seash 
                       environment.

  <Side Effects>
    The module specified in the 'modulename' node will be enabled.

  <Exceptions>
    UserError:
      input_dict did not contain a 'modulename' node, or the user tried to
      disable this module.

  <Returns>
    None
  """

  # Get the modulename
  dict_mark = input_dict
  try:
    command = dict_mark.keys()[0]
    while dict_mark[command]['name'] != 'modulename':
      dict_mark = input_dict[command]['children']
      command = dict_mark.keys()[0]
    modulename = command
  except IndexError:
    raise seash_exceptions.UserError("Error, command requires a modulename")

  if modulename == 'modules':
    raise seash_exceptions.UserError("Error, cannot disable the 'modules' module")

  seash_modules.disable(seash_dictionary.seashcommanddict, modulename)
Пример #3
0
        while dict_mark[command]['name'] != 'modulename':
            dict_mark = input_dict[command]['children']
            command = dict_mark.keys()[0]
        modulename = command
    except IndexError:
        raise seash_exceptions.UserError(
            "Error, command requires a modulename")

    try:
        seash_modules.enable(seash_dictionary.seashcommanddict, modulename)
    except seash_exceptions.ModuleConflictError, e:
        print "Module cannot be imported due to the following conflicting command:"
        print str(e)
    except seash_exceptions.InitializeError, e:
        print "Error while enabling the '" + modulename + "' module."
        seash_modules.disable(seash_dictionary.seashcommanddict, modulename)


def disable_module(input_dict, environment_dict):
    """
  <Purpose>
    Disables an enabled module.

  <Arguments>
    input_dict:  The commanddict representing the user's input.
    environment_dict:  The dictionary representing the current seash 
                       environment.

  <Side Effects>
    The module specified in the 'modulename' node will be enabled.
Пример #4
0
    command = dict_mark.keys()[0]
    while dict_mark[command]['name'] != 'modulename':
      dict_mark = input_dict[command]['children']
      command = dict_mark.keys()[0]
    modulename = command
  except IndexError:
    raise seash_exceptions.UserError("Error, command requires a modulename")

  try:
    seash_modules.enable(seash_dictionary.seashcommanddict, modulename)
  except seash_exceptions.ModuleConflictError, e:
    print "Module cannot be imported due to the following conflicting command:"
    print str(e)
  except seash_exceptions.InitializeError, e:
    print "Error while enabling the '"+modulename+"' module."
    seash_modules.disable(seash_dictionary.seashcommanddict, modulename)



def disable_module(input_dict, environment_dict):
  """
  <Purpose>
    Disables an enabled module.

  <Arguments>
    input_dict:  The commanddict representing the user's input.
    environment_dict:  The dictionary representing the current seash 
                       environment.

  <Side Effects>
    The module specified in the 'modulename' node will be enabled.
Пример #5
0
Also disables all modules so that individual module tests can assume a clean
module system before running.
"""

# Needed so that the built-in type function is restored to the python
# abc library
import seash_dictionary

# Disable all modules.
# We pass in an empty dict because we only care that the .disabled file gets
# created
import seash_modules
for module in seash_modules.get_enabled_modules():
    # The modules module must always be enabled.  Otherwise, we have no way of
    # enabling/disabling modules through the command loop.
    if module == 'modules':
        continue
    seash_modules.disable({}, module)

from repyportability import *
add_dy_support(locals())

dy_import_module_symbols('rsa.r2py')
dy_import_module_symbols('advertise.r2py')

for guestnum in xrange(4):
    guestkey = rsa_file_to_publickey('guest' + str(guestnum) + '.publickey')
    while not advertise_lookup(guestkey, graceperiod=1):
        sleep(2)
because the node manager isn't ready yet.

Also disables all modules so that individual module tests can assume a clean
module system before running.
"""

# Needed so that the built-in type function is restored to the python
# abc library
import seash_dictionary

# Disable all modules.
# We pass in an empty dict because we only care that the .disabled file gets 
# created
import seash_modules
for module in seash_modules.get_enabled_modules():
  # The modules module must always be enabled.  Otherwise, we have no way of
  # enabling/disabling modules through the command loop.
  if module == 'modules':
    continue
  seash_modules.disable({}, module)

from repyportability import *
add_dy_support(locals())

dy_import_module_symbols('rsa.repy')
dy_import_module_symbols('advertise.repy')

for guestnum in xrange(4):
  guestkey = rsa_file_to_publickey('guest'+str(guestnum)+'.publickey')
  while not advertise_lookup(guestkey, graceperiod=1):
    sleep(2)