Example #1
0
def load_plugins(plugins):
  """
  Imports all plugins given a list.
  :param plugins:
  Note:  Assumes they're all in sys.path.
  """
  for plugin in plugins:
    __import__(plugin, None, None, [''])
    if plugin not in OperationBase.__subclasses__(): #@UndefinedVariable
      # This takes care of importing zipped plugins:
      __import__(plugin, None, None, [plugin])
from hal_configurator.lib.command_base import OperationBase, \
    InvalidCommandArgumentsError, ArgumentDescriptor
CONDITION_BUNDLE = 'Incondition'
OperationBase.register_bundle(CONDITION_BUNDLE)


class Condition(OperationBase):
    """Create a condition"""
    code = "condition"

    def __init__(self, *args, **kwargs):
        super(Condition, self).__init__(*args, **kwargs)
        self.result = ''

    @classmethod
    def get_arg_descriptors(cls):
        return [
            ArgumentDescriptor("Expression", "Python Expression", "text"),
            ArgumentDescriptor("Bundle", "Operations Bundle",
                               "OperationsBundle"),
        ]

    @classmethod
    def get_empty_dict(cls):
        return{
            "Code": cls.get_code(),
            "Type": cls.get_name(),
            "Arguments": {
                "Expression": "\"true\"==\"true\"",
                "Bundle": {
                    "Name": CONDITION_BUNDLE,
Example #3
0
 def get_result(self):
   return OperationBase.get_result(self)
from hal_configurator.lib.command_base import OperationBase, \
  InvalidCommandArgumentsError, ArgumentDescriptor
CONDITION_BUNDLE = 'Incondition'
OperationBase.register_bundle(CONDITION_BUNDLE)


class Condition(OperationBase):
    """Create a While Loop"""
    code = "condition"

    def __init__(self, *args, **kwargs):
        super(Condition, self).__init__(*args, **kwargs)
        self.self_managed_resources = False
        self.self_managed_variables = True
        self.result = ''

    @classmethod
    def get_arg_descriptors(cls):
        return [
            ArgumentDescriptor("Expression", "Python Expression", "text"),
            ArgumentDescriptor("Bundle", "Operations Bundle",
                               "OperationsBundle"),
        ]

    @classmethod
    def get_empty_dict(cls):
        return {
            "Code": cls.get_code(),
            "Type": cls.get_name(),
            "Arguments": {
                "Expression": "\"true\"==\"true\"",
 def get_result(self):
     return OperationBase.get_result(self)
from hal_configurator.lib.command_base import OperationBase, ArgumentDescriptor
EMPTY_BUNDLE = 'InForLoop'
OperationBase.register_bundle(EMPTY_BUNDLE)


class EmptyBundle(OperationBase):
    def __init__(self, *args, **kwargs):
        super(EmptyBundle, self).__init__(*args, **kwargs)
        self.result = ''

    @classmethod
    def get_arg_descriptors(cls):
        return [
            ArgumentDescriptor("Bundle", "Operations Bundle",
                               "OperationsBundle"),
        ]

    @classmethod
    def get_empty_dict(cls):
        return {
            "Code": cls.get_code(),
            "Type": cls.get_name(),
            "Arguments": {
                "Bundle": {
                    "Name": EMPTY_BUNDLE,
                    "Operations": []
                }
            }
        }

    def run(self):
Example #7
0
from hal_configurator.lib.command_base import OperationBase, \
  InvalidCommandArgumentsError, ArgumentDescriptor
FORLOOP_BUNDLE = 'InForLoop'
OperationBase.register_bundle(FORLOOP_BUNDLE)

class ForLoop(OperationBase):
  """Create a condition"""
  code = "condition"
  def __init__(self,*args, **kwargs):
    super(ForLoop, self).__init__(*args, **kwargs)
    self.result = ''

  @classmethod
  def get_arg_descriptors(cls):
    return [
            ArgumentDescriptor("Array", "Comma separated array", "list"),
            ArgumentDescriptor("Bundle", "Operations Bundle", "OperationsBundle"),
           ]

  @classmethod
  def get_empty_dict(cls):
    return{
            "Code":cls.get_code(),
            "Type":cls.get_name(),
            "Arguments":{
              "Array":"[1,2,3]",
              "Bundle":{
                "Name": FORLOOP_BUNDLE,
                "Operations": []
              }
            }
from hal_configurator.lib.command_base import OperationBase, ArgumentDescriptor
EMPTY_BUNDLE = 'InForLoop'
OperationBase.register_bundle(EMPTY_BUNDLE)

class EmptyBundle(OperationBase):
  def __init__(self,*args, **kwargs):
    super(EmptyBundle, self).__init__(*args, **kwargs)
    self.result = ''

  @classmethod
  def get_arg_descriptors(cls):
    return [
            ArgumentDescriptor("Bundle", "Operations Bundle", "OperationsBundle"),
           ]
  @classmethod
  def get_empty_dict(cls):
    return{
            "Code":cls.get_code(),
            "Type":cls.get_name(),
            "Arguments":{
              "Bundle":{
                "Name": EMPTY_BUNDLE,
                "Operations": []
              }
            }
          }
  def run(self):
    self.executor.execute_bundle_within_current_scope(self.kwargs["Bundle"])
__plugin__ = EmptyBundle
Example #9
0
from hal_configurator.lib.command_base import OperationBase, \
  InvalidCommandArgumentsError, ArgumentDescriptor
FORLOOP_BUNDLE = 'InForLoop'
OperationBase.register_bundle(FORLOOP_BUNDLE)


class ForLoop(OperationBase):
    """Create a condition"""
    code = "condition"

    def __init__(self, *args, **kwargs):
        super(ForLoop, self).__init__(*args, **kwargs)
        self.result = ''

    @classmethod
    def get_arg_descriptors(cls):
        return [
            ArgumentDescriptor("Array", "Comma separated array", "list"),
            ArgumentDescriptor("Bundle", "Operations Bundle",
                               "OperationsBundle"),
        ]

    @classmethod
    def get_empty_dict(cls):
        return {
            "Code": cls.get_code(),
            "Type": cls.get_name(),
            "Arguments": {
                "Array": "[1,2,3]",
                "Bundle": {
                    "Name": FORLOOP_BUNDLE,