Exemplo n.º 1
0
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,
Exemplo n.º 2
0
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\"",
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):
Exemplo n.º 4
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": []
              }
            }
Exemplo n.º 5
0
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
Exemplo n.º 6
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,