Ejemplo n.º 1
0
 def __init__(self, password, login='******', ip='127.0.0.1'):
     """ Function __init__
     Init the API with the connection params
     @param password: authentication password
     @param password: authentication login - default is admin
     @param ip: api ip - default is localhost
     @return RETURN: self
     """
     self.api = Api(login=login,
                    password=password,
                    ip=ip,
                    printErrors=False)
     self.domains = Domains(self.api)
     self.smartProxies = SmartProxies(self.api)
     self.puppetClasses = PuppetClasses(self.api)
     self.operatingSystems = OperatingSystems(self.api)
     self.architectures = Architectures(self.api)
     self.subnets = Subnets(self.api)
     self.hostgroups = HostGroups(self.api)
     self.hosts = Hosts(self.api)
     self.computeResources = ComputeResources(self.api)
     self.environments = Environments(self.api)
     self.configTemplates = ConfigTemplates(self.api)
     self.smartClassParameters = SmartClassParameters(self.api)
     self.settings = ForemanObjects(self.api, 'settings', 'setting')
     self.ptables = ForemanObjects(self.api, 'ptables', 'ptable')
     self.media = ForemanObjects(self.api, 'media', 'medium')
Ejemplo n.º 2
0
    def __delitem__(self, key):
        """ Function __delitem__
        Delete an hostgroup

        @param key: The hostgroup name or ID
        @return RETURN: The API result
        """
        # Because Hostgroup did not support get by name we need to do it by id
        if type(key) is not int:
            key = self.listName()[key]
        return ForemanObjects.__delitem__(self, key)
Ejemplo n.º 3
0
    def __getitem__(self, key):
        """ Function __getitem__
        Get an hostgroup

        @param key: The hostgroup name or ID
        @return RETURN: The ItemHostsGroup object of an host
        """
        # Because Hostgroup did not support get by name we need to do it by id
        if type(key) is not int:
            key = self.listName()[key]
        return ForemanObjects.__getitem__(self, key)
Ejemplo n.º 4
0
    def __delitem__(self, key):
        """ Function __delitem__
        Delete an hostgroup

        @param key: The hostgroup name or ID
        @return RETURN: The API result
        """
        # Because Hostgroup did not support get by name we need to do it by id
        if type(key) is not int:
            key = self.listName()[key]
        return ForemanObjects.__delitem__(self, key)
Ejemplo n.º 5
0
    def __getitem__(self, key):
        """ Function __getitem__
        Get an hostgroup

        @param key: The hostgroup name or ID
        @return RETURN: The ItemHostsGroup object of an host
        """
        # Because Hostgroup did not support get by name we need to do it by id
        if type(key) is not int:
            key = self.listName()[key]
        return ForemanObjects.__getitem__(self, key)