示例#1
0
    def __init__(self, params, parsing=True):

        if 'commands' in params:
            commands = params['commands']
            self.call = params['call']
            self.enable_environment_macros = params.get(
                'enable_environment_macros', False)
            self.uuid = uuidmod.uuid4().hex
            self.timeout = -1
            command, self.args = self.get_command_and_args()
            self.command = commands.find_by_name(command)
            self.late_relink_done = False  # To do not relink again and again the same commandcall
            self.valid = self.command is not None
            if self.valid:
                # If the host/service do not give an override poller_tag, take
                # the one of the command
                self.poller_tag = params.get('poller_tag',
                                             'None')  # from host/service
                self.reactionner_tag = params.get('reactionner_tag', 'None')
                self.module_type = self.command.module_type
                self.enable_environment_macros = self.command.enable_environment_macros
                self.timeout = int(self.command.timeout)
                if self.valid and self.poller_tag == 'None':
                    # from command if not set
                    self.poller_tag = self.command.poller_tag
                # Same for reactionner tag
                if self.valid and self.reactionner_tag == 'None':
                    # from command if not set
                    self.reactionner_tag = self.command.reactionner_tag
        else:
            super(CommandCall, self).__init__(params, parsing=parsing)
            self.command = Command(params['command'], parsing=parsing)
示例#2
0
    def __init__(self, params, parsing=False):
        """
        A CommandCall may receive several commands in its parameters

        Thus, we must manage this specific configuration

        If no commands list is provided, the CommandCall is initialized with the provided
        paramters that also contain one Command. We must re-create a Command object and link
        this object to the CommandCall.

        :param params:
        :param parsing:
        """
        # We received one command
        if 'commands' not in params:
            # Create a base command call
            super(CommandCall, self).__init__(params, parsing=parsing)
            # Link the provided Alignak command with myself
            self.command = Command(params['command'], parsing=parsing)
            return

        # We received a commands list
        commands = params['commands']
        params.pop('commands')
        # Create a base command call
        super(CommandCall, self).__init__(params, parsing=parsing)

        # self.call = params['call']
        # self.enable_environment_macros = params.get('enable_environment_macros', False)
        # self.uuid = uuidmod.uuid4().hex
        self.timeout = -1
        command, self.args = self.get_command_and_args()
        self.command = commands.find_by_name(command)
        self.late_relink_done = False  # To do not relink again and again the same commandcall
        self.valid = self.command is not None
        if self.valid:
            # If the host/service do not give an override poller_tag, take
            # the one of the command
            self.poller_tag = params.get('poller_tag',
                                         u'None')  # from host/service
            self.reactionner_tag = params.get('reactionner_tag', u'None')
            self.module_type = self.command.module_type
            self.enable_environment_macros = self.command.enable_environment_macros
            self.timeout = int(self.command.timeout)
            if self.poller_tag == u'None':
                # from command if not set
                self.poller_tag = self.command.poller_tag
            # Same for reactionner tag
            if self.reactionner_tag == u'None':
                # from command if not set
                self.reactionner_tag = self.command.reactionner_tag
示例#3
0
    def __init__(self, params, parsing=False):
        """
        A CommandCall may receive several commands in its parameters

        Thus, we must manage this specific configuration

        If no commands list is provided, the CommandCall is initialized with the provided
        paramters that also contain one Command. We must re-create a Command object and link
        this object to the CommandCall.

        :param params:
        :param parsing:
        """
        # We received one command
        if 'commands' not in params:
            # Create a base command call
            super(CommandCall, self).__init__(params, parsing=parsing)
            # Link the provided Alignak command with myself
            self.command = Command(params['command'], parsing=parsing)
            return

        # We received a commands list
        commands = params['commands']
        params.pop('commands')
        # Create a base command call
        super(CommandCall, self).__init__(params, parsing=parsing)

        # self.call = params['call']
        # self.enable_environment_macros = params.get('enable_environment_macros', False)
        # self.uuid = uuidmod.uuid4().hex
        self.timeout = -1
        command, self.args = self.get_command_and_args()
        self.command = commands.find_by_name(command)
        self.late_relink_done = False  # To do not relink again and again the same commandcall
        self.valid = self.command is not None
        if self.valid:
            # If the host/service do not give an override poller_tag, take
            # the one of the command
            self.poller_tag = params.get('poller_tag', u'None')  # from host/service
            self.reactionner_tag = params.get('reactionner_tag', u'None')
            self.module_type = self.command.module_type
            self.enable_environment_macros = self.command.enable_environment_macros
            self.timeout = int(self.command.timeout)
            if self.poller_tag == u'None':
                # from command if not set
                self.poller_tag = self.command.poller_tag
            # Same for reactionner tag
            if self.reactionner_tag == u'None':
                # from command if not set
                self.reactionner_tag = self.command.reactionner_tag
示例#4
0
 def setUp(self):
     from alignak.objects.command import Command
     self.item = None
     self.item = Command(parsing=True)
     print self.item.properties
示例#5
0
    def test_types(self):  # pylint: disable=R0912
        """ Test properties types

        :return: None
        """
        self.setup_with_file('cfg/cfg_default.cfg')

        for objects in (self._arbiter.conf.arbiters,
                        self._arbiter.conf.contacts,
                        self._arbiter.conf.notificationways,
                        self._arbiter.conf.hosts):
            self.check_objects_from(objects)

        print("== test Check() ==")
        check = Check({
            'status': u'OK',
            'command': u'check_ping',
            'ref': 0,
            't_to_go': 10.0
        })
        for prop in check.properties:
            if hasattr(check, prop):
                value = getattr(check, prop)
                if prop not in ['ref']:  # TODO : clean this
                    # We should get rid of None, maybe use the "neutral" value for type
                    if value is not None:
                        print("TESTING %s with value %s" % (prop, value))
                        obj_expected_type = self.map_type(
                            check.properties[prop])
                        # These properties are pure bytes string
                        if prop in ['uuid']:
                            obj_expected_type = bytes

                        assert isinstance(value, obj_expected_type), \
                            "The %s attr/property of %s object isn't a %s: %s, value=%s" \
                            % (prop, check.properties, obj_expected_type, value.__class__, value)
                    else:
                        print("Skipping %s " % prop)

        print("== test Notification() ==")
        notification = Notification()
        for prop in notification.properties:
            if not hasattr(notification, prop):
                continue
            value = getattr(notification, prop)
            # We should get ride of None, maybe use the "neutral" value for type
            if prop not in ['already_start_escalations']:  # TODO : clean this
                if value is not None:
                    print("TESTING %s with value %s" % (prop, value))
                    obj_expected_type = self.map_type(
                        notification.properties[prop])
                    # These properties are pure bytes string
                    if prop in ['uuid']:
                        obj_expected_type = bytes

                    assert isinstance(value, obj_expected_type), \
                        "The %s attr/property of %s object isn't a %s: %s, value=%s" \
                        % (prop, check.properties, obj_expected_type, value.__class__, value)
                else:
                    print("Skipping %s " % prop)

        print("== test EventHandler() ==")
        eventhandler = EventHandler({})
        for prop in eventhandler.properties:
            if not hasattr(eventhandler, prop):
                continue
            value = getattr(eventhandler, prop)
            if value is not None:
                print("TESTING %s with value %s" % (prop, value))
                obj_expected_type = self.map_type(
                    eventhandler.properties[prop])
                # These properties are pure bytes string
                if prop in ['uuid', 'command']:
                    obj_expected_type = bytes
                if prop in ['command']:
                    continue

                assert isinstance(value, obj_expected_type), \
                    "The '%s' attr/property of %s object isn't a %s: %s, value=%s" \
                    % (prop, check.properties, obj_expected_type, value.__class__, value)
            else:
                print("Skipping %s " % prop)

        print("== test Timeperiod() ==")
        timeperiod = Timeperiod()
        for prop in timeperiod.properties:
            if not hasattr(timeperiod, prop):
                continue
            value = getattr(timeperiod, prop)
            # We should get ride of None, maybe use the "neutral" value for type
            if value is not None:
                print("TESTING %s with value %s" % (prop, value))
                obj_expected_type = self.map_type(timeperiod.properties[prop])
                # These properties are pure bytes string
                if prop in ['uuid']:
                    obj_expected_type = bytes

                assert isinstance(value, obj_expected_type), \
                    "The %s attr/property of %s object isn't a %s: %s, value=%s" \
                    % (prop, check.properties, obj_expected_type, value.__class__, value)
            else:
                print("Skipping %s " % prop)

        print("== test Command() ==")
        command = Command({})
        for prop in command.properties:
            if hasattr(command, prop):
                value = getattr(command, prop)
                # We should get ride of None, maybe use the "neutral" value for type
                if value is not None:
                    print("TESTING %s with value %s" % (prop, value))
                    obj_expected_type = self.map_type(command.properties[prop])
                    # These properties are pure bytes string
                    if prop in ['uuid']:
                        obj_expected_type = bytes

                    print("TESTING %s with value %s" % (prop, value))
                    assert isinstance(value, obj_expected_type), \
                        "The %s attr/property of %s object isn't a %s: %s, value=%s" \
                        % (prop, check.properties, obj_expected_type, value.__class__, value)
                else:
                    print("Skipping %s " % prop)
示例#6
0
class CommandCall(AlignakObject):
    # pylint: disable=too-many-instance-attributes
    """This class is use when a service, contact or host define
    a command with args.
    """

    # AutoSlots create the __slots__ with properties and
    # running_properties names
    __metaclass__ = AutoSlots

    my_type = 'CommandCall'

    properties = {
        'call':
            StringProp(),
        'command':
            StringProp(),
        'poller_tag':
            StringProp(default=u'None'),
        'reactionner_tag':
            StringProp(default=u'None'),
        'module_type':
            StringProp(default=u'fork'),
        'valid':
            BoolProp(default=False),
        'args':
            ListProp(default=[]),
        'timeout':
            IntegerProp(default=-1),
        'late_relink_done':
            BoolProp(default=False),
        'enable_environment_macros':
            BoolProp(default=False),
    }

    def __init__(self, params, parsing=False):
        """
        A CommandCall may receive several commands in its parameters

        Thus, we must manage this specific configuration

        If no commands list is provided, the CommandCall is initialized with the provided
        paramters that also contain one Command. We must re-create a Command object and link
        this object to the CommandCall.

        :param params:
        :param parsing:
        """
        # We received one command
        if 'commands' not in params:
            # Create a base command call
            super(CommandCall, self).__init__(params, parsing=parsing)
            # Link the provided Alignak command with myself
            self.command = Command(params['command'], parsing=parsing)
            return

        # We received a commands list
        commands = params['commands']
        params.pop('commands')
        # Create a base command call
        super(CommandCall, self).__init__(params, parsing=parsing)

        # self.call = params['call']
        # self.enable_environment_macros = params.get('enable_environment_macros', False)
        # self.uuid = uuidmod.uuid4().hex
        self.timeout = -1
        command, self.args = self.get_command_and_args()
        self.command = commands.find_by_name(command)
        self.late_relink_done = False  # To do not relink again and again the same commandcall
        self.valid = self.command is not None
        if self.valid:
            # If the host/service do not give an override poller_tag, take
            # the one of the command
            self.poller_tag = params.get('poller_tag', u'None')  # from host/service
            self.reactionner_tag = params.get('reactionner_tag', u'None')
            self.module_type = self.command.module_type
            self.enable_environment_macros = self.command.enable_environment_macros
            self.timeout = int(self.command.timeout)
            if self.poller_tag == u'None':
                # from command if not set
                self.poller_tag = self.command.poller_tag
            # Same for reactionner tag
            if self.reactionner_tag == u'None':
                # from command if not set
                self.reactionner_tag = self.command.reactionner_tag

    def serialize(self):
        cls = self.__class__
        # id is not in *_properties
        res = {'uuid': self.uuid}
        for prop in cls.properties:
            if hasattr(self, prop):
                res[prop] = getattr(self, prop)

        res['command'] = None
        if self.command:
            res['command'] = self.command.serialize()
        return res

    def get_command_and_args(self):
        r"""We want to get the command and the args with ! splitting.
        but don't forget to protect against the \! to avoid splitting on them

        Remember: A Nagios-like command is command_name!arg1!arg2!...

        :return: None
        """

        # First protect
        p_call = self.call.replace(r'\!', '___PROTECT_EXCLAMATION___')
        tab = p_call.split('!')
        return tab[0].strip(), [s.replace('___PROTECT_EXCLAMATION___', '!') for s in tab[1:]]

    def is_valid(self):
        """Getter for valid attribute

        :return: True if object is valid, False otherwise
        :rtype: bool
        """
        return self.valid

    def __str__(self):  # pragma: no cover
        return str(self.__dict__)

    def get_name(self):
        """Getter for call attribute

        :return: call attribute
        :rtype: str
        """
        return self.call
示例#7
0
    def test_types(self):
        path = 'etc/alignak_1r_1h_1s.cfg'
        time_hacker.set_my_time()
        self.print_header()
        # i am arbiter-like
        self.broks = {}
        self.me = None
        self.log = logger
        self.log.setLevel("INFO")
        self.log.load_obj(self)
        self.config_files = [path]
        self.conf = Config()
        buf = self.conf.read_config(self.config_files)
        raw_objects = self.conf.read_config_buf(buf)
        self.conf.create_objects_for_type(raw_objects, 'arbiter')
        self.conf.create_objects_for_type(raw_objects, 'module')
        self.conf.early_arbiter_linking()
        self.conf.create_objects(raw_objects)
        self.conf.instance_id = 0
        self.conf.instance_name = 'test'
        # Hack push_flavor, that is set by the dispatcher
        self.conf.push_flavor = 0
        self.conf.load_triggers()
        self.conf.linkify_templates()
        self.conf.apply_inheritance()
        self.conf.explode()

        self.conf.apply_implicit_inheritance()
        self.conf.fill_default()
        self.conf.remove_templates()

        self.conf.override_properties()
        self.conf.linkify()
        self.conf.apply_dependencies()
        self.conf.explode_global_conf()
        self.conf.propagate_timezone_option()
        self.conf.create_business_rules()
        self.conf.create_business_rules_dependencies()
        self.conf.is_correct()

        ###############

        for objects in (self.conf.arbiters, self.conf.contacts,
                        self.conf.notificationways, self.conf.hosts):
            self.check_objects_from(objects)

        print "== test Check() =="
        check = Check('OK', 'check_ping', 0, 10.0)
        for prop in check.properties:
            if hasattr(check, prop):
                value = getattr(check, prop)
                # We should get ride of None, maybe use the "neutral" value for type
                if prop not in ['ref']:  # TODO : clean this
                    if value is not None:
                        print("TESTING %s with value %s" % (prop, value))
                        self.assertIsInstance(
                            value, self.map_type(check.properties[prop]))
                    else:
                        print("Skipping %s " % prop)

        print "== test Notification() =="
        notification = Notification()
        for prop in notification.properties:
            if hasattr(notification, prop):
                value = getattr(notification, prop)
                # We should get ride of None, maybe use the "neutral" value for type
                if prop not in ['already_start_escalations'
                                ]:  # TODO : clean this
                    if value is not None:
                        print("TESTING %s with value %s" % (prop, value))
                        self.assertIsInstance(
                            value,
                            self.map_type(notification.properties[prop]))
                    else:
                        print("Skipping %s " % prop)

        print "== test EventHandler() =="
        eventhandler = EventHandler('')
        for prop in eventhandler.properties:
            if hasattr(eventhandler, prop):
                value = getattr(eventhandler, prop)
                # We should get ride of None, maybe use the "neutral" value for type
                if prop not in ['jjjj']:  # TODO : clean this
                    if value is not None:
                        print("TESTING %s with value %s" % (prop, value))
                        self.assertIsInstance(
                            value,
                            self.map_type(eventhandler.properties[prop]))
                    else:
                        print("Skipping %s " % prop)

        print "== test Timeperiod() =="
        timeperiod = Timeperiod()
        for prop in timeperiod.properties:
            if hasattr(timeperiod, prop):
                value = getattr(timeperiod, prop)
                # We should get ride of None, maybe use the "neutral" value for type
                if value is not None:
                    print("TESTING %s with value %s" % (prop, value))
                    self.assertIsInstance(
                        value, self.map_type(timeperiod.properties[prop]))
                else:
                    print("Skipping %s " % prop)

        print "== test Command() =="
        command = Command({})
        for prop in command.properties:
            if hasattr(command, prop):
                value = getattr(command, prop)
                # We should get ride of None, maybe use the "neutral" value for type
                if value is not None:
                    print("TESTING %s with value %s" % (prop, value))
                    self.assertIsInstance(
                        value, self.map_type(command.properties[prop]))
                else:
                    print("Skipping %s " % prop)
示例#8
0
class CommandCall(AlignakObject):
    # pylint: disable=too-many-instance-attributes
    """This class is use when a service, contact or host define
    a command with args.
    """

    # AutoSlots create the __slots__ with properties and
    # running_properties names
    __metaclass__ = AutoSlots

    my_type = 'CommandCall'

    properties = {
        'call': StringProp(),
        'command': StringProp(),
        'poller_tag': StringProp(default=u'None'),
        'reactionner_tag': StringProp(default=u'None'),
        'module_type': StringProp(default=u'fork'),
        'valid': BoolProp(default=False),
        'args': ListProp(default=[]),
        'timeout': IntegerProp(default=-1),
        'late_relink_done': BoolProp(default=False),
        'enable_environment_macros': BoolProp(default=False),
    }

    def __init__(self, params, parsing=False):
        """
        A CommandCall may receive several commands in its parameters

        Thus, we must manage this specific configuration

        If no commands list is provided, the CommandCall is initialized with the provided
        paramters that also contain one Command. We must re-create a Command object and link
        this object to the CommandCall.

        :param params:
        :param parsing:
        """
        # We received one command
        if 'commands' not in params:
            # Create a base command call
            super(CommandCall, self).__init__(params, parsing=parsing)
            # Link the provided Alignak command with myself
            self.command = Command(params['command'], parsing=parsing)
            return

        # We received a commands list
        commands = params['commands']
        params.pop('commands')
        # Create a base command call
        super(CommandCall, self).__init__(params, parsing=parsing)

        # self.call = params['call']
        # self.enable_environment_macros = params.get('enable_environment_macros', False)
        # self.uuid = uuidmod.uuid4().hex
        self.timeout = -1
        command, self.args = self.get_command_and_args()
        self.command = commands.find_by_name(command)
        self.late_relink_done = False  # To do not relink again and again the same commandcall
        self.valid = self.command is not None
        if self.valid:
            # If the host/service do not give an override poller_tag, take
            # the one of the command
            self.poller_tag = params.get('poller_tag',
                                         u'None')  # from host/service
            self.reactionner_tag = params.get('reactionner_tag', u'None')
            self.module_type = self.command.module_type
            self.enable_environment_macros = self.command.enable_environment_macros
            self.timeout = int(self.command.timeout)
            if self.poller_tag == u'None':
                # from command if not set
                self.poller_tag = self.command.poller_tag
            # Same for reactionner tag
            if self.reactionner_tag == u'None':
                # from command if not set
                self.reactionner_tag = self.command.reactionner_tag

    def serialize(self):
        cls = self.__class__
        # id is not in *_properties
        res = {'uuid': self.uuid}
        for prop in cls.properties:
            if hasattr(self, prop):
                res[prop] = getattr(self, prop)

        res['command'] = None
        if self.command:
            res['command'] = self.command.serialize()
        return res

    def get_command_and_args(self):
        r"""We want to get the command and the args with ! splitting.
        but don't forget to protect against the \! to avoid splitting on them

        Remember: A Nagios-like command is command_name!arg1!arg2!...

        :return: None
        """

        # First protect
        p_call = self.call.replace(r'\!', '___PROTECT_EXCLAMATION___')
        tab = p_call.split('!')
        return tab[0].strip(), [
            s.replace('___PROTECT_EXCLAMATION___', '!') for s in tab[1:]
        ]

    def is_valid(self):
        """Getter for valid attribute

        :return: True if object is valid, False otherwise
        :rtype: bool
        """
        return self.valid

    def __str__(self):  # pragma: no cover
        return str(self.__dict__)

    def get_name(self):
        """Getter for call attribute

        :return: call attribute
        :rtype: str
        """
        return self.call
示例#9
0
 def setUp(self):
     super(TestCommand, self).setUp()
     from alignak.objects.command import Command
     self.item = None
     self.item = Command(parsing=True)
     print(self.item.properties)
示例#10
0
 def setUp(self):
     from alignak.objects.command import Command
     self.item = Command()
示例#11
0
    def test_types(self):  # pylint: disable=R0912
        """ Test properties types

        :return: None
        """
        self.print_header()
        self.setup_with_file('cfg/cfg_default.cfg')

        for objects in (self.arbiter.conf.arbiters, self.arbiter.conf.contacts,
                        self.arbiter.conf.notificationways,
                        self.arbiter.conf.hosts):
            self.check_objects_from(objects)

        print "== test Check() =="
        check = Check({
            'status': 'OK',
            'command': 'check_ping',
            'ref': 0,
            't_to_go': 10.0
        })
        for prop in check.properties:
            if hasattr(check, prop):
                value = getattr(check, prop)
                # We should get ride of None, maybe use the "neutral" value for type
                if prop not in ['ref']:  # TODO : clean this
                    if value is not None:
                        print "TESTING %s with value %s" % (prop, value)
                        assert isinstance(
                            value, self.map_type(check.properties[prop]))
                    else:
                        print "Skipping %s " % prop

        print "== test Notification() =="
        notification = Notification()
        for prop in notification.properties:
            if hasattr(notification, prop):
                value = getattr(notification, prop)
                # We should get ride of None, maybe use the "neutral" value for type
                if prop not in ['already_start_escalations'
                                ]:  # TODO : clean this
                    if value is not None:
                        print "TESTING %s with value %s" % (prop, value)
                        assert isinstance(
                            value,
                            self.map_type(notification.properties[prop]))
                    else:
                        print "Skipping %s " % prop

        print "== test EventHandler() =="
        eventhandler = EventHandler({})
        for prop in eventhandler.properties:
            if hasattr(eventhandler, prop):
                value = getattr(eventhandler, prop)
                # We should get ride of None, maybe use the "neutral" value for type
                if prop not in ['jjjj']:  # TODO : clean this
                    if value is not None:
                        print "TESTING %s with value %s" % (prop, value)
                        assert isinstance(
                            value,
                            self.map_type(eventhandler.properties[prop]))
                    else:
                        print "Skipping %s " % prop

        print "== test Timeperiod() =="
        timeperiod = Timeperiod()
        for prop in timeperiod.properties:
            if hasattr(timeperiod, prop):
                value = getattr(timeperiod, prop)
                # We should get ride of None, maybe use the "neutral" value for type
                if value is not None:
                    print "TESTING %s with value %s" % (prop, value)
                    assert isinstance(
                        value, self.map_type(timeperiod.properties[prop]))
                else:
                    print "Skipping %s " % prop

        print "== test Command() =="
        command = Command({})
        for prop in command.properties:
            if hasattr(command, prop):
                value = getattr(command, prop)
                # We should get ride of None, maybe use the "neutral" value for type
                if value is not None:
                    print "TESTING %s with value %s" % (prop, value)
                    assert isinstance(value,
                                      self.map_type(command.properties[prop]))
                else:
                    print "Skipping %s " % prop
示例#12
0
class CommandCall(AlignakObject):
    """This class is use when a service, contact or host define
    a command with args.
    """
    # AutoSlots create the __slots__ with properties and
    # running_properties names
    __metaclass__ = AutoSlots

    # __slots__ = ('uuid', 'call', 'command', 'valid', 'args', 'poller_tag',
    #              'reactionner_tag', 'module_type', '__dict__')
    my_type = 'CommandCall'

    properties = {
        'call': StringProp(),
        'command': StringProp(),
        'poller_tag': StringProp(default='None'),
        'reactionner_tag': StringProp(default='None'),
        'module_type': StringProp(default='fork'),
        'valid': BoolProp(default=False),
        'args': ListProp(default=[]),
        'timeout': IntegerProp(default=-1),
        'late_relink_done': BoolProp(default=False),
        'enable_environment_macros': BoolProp(default=False),
    }

    def __init__(self, params, parsing=True):

        if 'commands' in params:
            commands = params['commands']
            self.call = params['call']
            self.enable_environment_macros = params.get(
                'enable_environment_macros', False)
            self.uuid = uuidmod.uuid4().hex
            self.timeout = -1
            command, self.args = self.get_command_and_args()
            self.command = commands.find_by_name(command)
            self.late_relink_done = False  # To do not relink again and again the same commandcall
            self.valid = self.command is not None
            if self.valid:
                # If the host/service do not give an override poller_tag, take
                # the one of the command
                self.poller_tag = params.get('poller_tag',
                                             'None')  # from host/service
                self.reactionner_tag = params.get('reactionner_tag', 'None')
                self.module_type = self.command.module_type
                self.enable_environment_macros = self.command.enable_environment_macros
                self.timeout = int(self.command.timeout)
                if self.valid and self.poller_tag == 'None':
                    # from command if not set
                    self.poller_tag = self.command.poller_tag
                # Same for reactionner tag
                if self.valid and self.reactionner_tag == 'None':
                    # from command if not set
                    self.reactionner_tag = self.command.reactionner_tag
        else:
            super(CommandCall, self).__init__(params, parsing=parsing)
            self.command = Command(params['command'], parsing=parsing)

    def serialize(self):
        cls = self.__class__
        # id is not in *_properties
        res = {'uuid': self.uuid}
        for prop in cls.properties:
            if hasattr(self, prop):
                res[prop] = getattr(self, prop)

        res['command'] = self.command.serialize()
        return res

    def get_command_and_args(self):
        r"""We want to get the command and the args with ! splitting.
        but don't forget to protect against the \! to do not split them

        :return: None
        """

        # First protect
        p_call = self.call.replace(r'\!', '___PROTECT_EXCLAMATION___')
        tab = p_call.split('!')
        return tab[0].strip(), [
            s.replace('___PROTECT_EXCLAMATION___', '!') for s in tab[1:]
        ]

    def is_valid(self):
        """Getter for valid attribute

        :return: True if object is valid, False otherwise
        :rtype: bool
        """
        return self.valid

    def __str__(self):
        return str(self.__dict__)

    def get_name(self):
        """Getter for call attribute

        :return: call attribute
        :rtype: str
        """
        return self.call