Пример #1
0
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """
        if key in ['parameters', 'interfaces', 'smart_class_parameters']:
            print('Can not assign {} directly, use .append()'.format(key))
            return False
        elif key in ['puppetclasses']:
            return ForemanItem.__setitem__(self, self[key].objType.payloadObj,
                                           attributes)
        elif key in ['power']:
            return self.api.set(self.objName,
                                '{}/{}'.format(self.key, 'power'), {
                                    "power_action": attributes,
                                    "host": {}
                                })
        elif key in ['boot']:
            return self.api.set(self.objName, '{}/{}'.format(self.key, 'boot'),
                                {
                                    "device": attributes,
                                    "host": {}
                                })
        else:
            return ForemanItem.__setitem__(self, key, attributes)
Пример #2
0
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """
        if key in ['parameters', 'interfaces', 'smart_class_parameters']:
            print('Can not assign {} directly, use .append()'.format(key))
            return False
        elif key in ['puppetclasses']:
            return ForemanItem.__setitem__(self,
                                           self[key].objType.payloadObj,
                                           attributes)
        elif key in ['power']:
            return self.api.set(self.objName,
                                '{}/{}'.format(self.key, 'power'),
                                {"power_action": attributes, "host": {}})
        elif key in ['boot']:
            return self.api.set(self.objName,
                                '{}/{}'.format(self.key, 'boot'),
                                {"device": attributes, "host": {}})
        else:
            return ForemanItem.__setitem__(self, key, attributes)
Пример #3
0
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """

        if key in ['images']:
            return ForemanItem.__setitem__(self, self[key].objType.payloadObj,
                                           attributes)
        else:
            return ForemanItem.__setitem__(self, key, attributes)
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """

        if key in ['images']:
            return ForemanItem.__setitem__(self,
                                           self[key].objType.payloadObj,
                                           attributes)
        else:
            return ForemanItem.__setitem__(self, key, attributes)
Пример #5
0
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """

        if key in ['os_default_templates']:
            return False
        elif key in ['config_templates', 'ptables', 'media', 'architectures']:
            return ForemanItem.__setitem__(self, self[key].objType.payloadObj,
                                           attributes)
        else:
            return ForemanItem.__setitem__(self, key, attributes)
Пример #6
0
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """

        if key in ['os_default_templates']:
            pp(attributes)
            print('Can not assign {} directly, use +='.format(key))
            return False
        elif key in ['operatingsystems']:
            return ForemanItem.__setitem__(self, self[key].objType.payloadObj,
                                           attributes)
        else:
            return ForemanItem.__setitem__(self, key, attributes)
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """

        if key in ['os_default_templates']:
            pp(attributes)
            print('Can not assign {} directly, use +='.format(key))
            return False
        elif key in ['operatingsystems']:
            return ForemanItem.__setitem__(self,
                                           self[key].objType.payloadObj,
                                           attributes)
        else:
            return ForemanItem.__setitem__(self, key, attributes)
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """

        if key in ['os_default_templates']:
            return False
        elif key in ['config_templates',
                     'ptables',
                     'media',
                     'architectures']:
            return ForemanItem.__setitem__(self,
                                           self[key].objType.payloadObj,
                                           attributes)
        else:
            return ForemanItem.__setitem__(self, key, attributes)
Пример #9
0
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """
        if key in ['override_values']:
            print('Can not assign {} directly, use .append()'.format(key))
            return False
        else:
            return ForemanItem.__setitem__(self, key, attributes)
Пример #10
0
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """
        if key in ['override_values']:
            print('Can not assign {} directly, use .append()'.format(key))
            return False
        else:
            return ForemanItem.__setitem__(self, key, attributes)
Пример #11
0
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """
        print('*' * 10 + ' setitem hostgroup')
        if key in ['parameters', 'smart_class_parameters', 'puppetclasses']:
            print('Can not assign {} directly, use .append()'.format(key))
            return False
        else:
            return ForemanItem.__setitem__(self, key, attributes)
    def __setitem__(self, key, attributes):
        """ Function __setitem__
        Set a parameter of a foreman object as a dict

        @param key: The key to modify
        @param attribute: The data
        @return RETURN: The API result
        """
        print('*'*10+' setitem hostgroup')
        if key in ['parameters', 'smart_class_parameters', 'puppetclasses']:
            print('Can not assign {} directly, use .append()'.format(key))
            return False
        else:
            return ForemanItem.__setitem__(self, key, attributes)