Ejemplo n.º 1
0
    def update(self, org_id, cv_id, label, description):
        view = {}
        view = update_dict_unless_none(view, "label", label)
        view = update_dict_unless_none(view, "description", description)

        path = "/api/organizations/%s/content_views/%s" % (org_id, cv_id)
        return self.server.PUT(path, {"content_view": view})[1]
Ejemplo n.º 2
0
 def update(self, repo_id, gpgkey, nogpgkey):
     repodata = {}
     update_dict_unless_none(repodata, "gpg_key_name", gpgkey)
     if nogpgkey:
         repodata["gpg_key_name"] = ""
     path = "/api/repositories/%s/" % repo_id
     return self.server.PUT(path, {"repository": repodata })[1]
Ejemplo n.º 3
0
    def update(self, csId, newName, description):
        data = {}
        data = update_dict_unless_none(data, "name", newName)
        data = update_dict_unless_none(data, "description", description)

        path = "/api/changesets/%s" % csId
        return self.server.PUT(path, {"changeset": data})[1]
Ejemplo n.º 4
0
    def update(self, keyId, name, content):
        keyData = {}
        keyData = update_dict_unless_none(keyData, "name", name)
        keyData = update_dict_unless_none(keyData, "content", content)

        path = "/api/gpg_keys/%s/" % keyId
        return self.server.PUT(path, {'gpg_key': keyData})[1]
Ejemplo n.º 5
0
    def run(self):
        org_name = self.get_option('org')
        sys_name = self.get_option('name')
        system_group_names = self.get_option('system_group_names')
        sys_uuid = self.get_option('uuid')

        query = {}
        update_dict_unless_none(query, "name", sys_name)
        update_dict_unless_none(query, "uuid", sys_uuid)
        system = self.api.systems_by_org(org_name, query)

        if system is None or len(system) == 0:
            return os.EX_DATAERR
        elif len(system) > 1:
            print constants.OPT_ERR_SYSTEM_AMBIGUOUS
            return os.EX_DATAERR
        else:
            system = system[0]

        system_groups = SystemGroupAPI().system_groups(org_name, { 'name' : system_group_names})

        if system_groups is None:
            return os.EX_DATAERR

        system_group_ids = [group["id"] for group in system_groups]

        system = self.api.remove_system_groups(system["uuid"], system_group_ids)

        if system != None:
            print _("Successfully removed system groups from system [ %s ]") % system['name']
            return os.EX_OK
        else:
            return os.EX_DATAERR
Ejemplo n.º 6
0
    def update(self, org, cvd_id, name, description):
        cvd = {"id": cvd_id}
        cvd = update_dict_unless_none(cvd, "name", name)
        cvd = update_dict_unless_none(cvd, "description", description)

        path = "/api/organizations/%s/content_view_definitions/%s" % \
                (org, cvd_id)
        return self.server.PUT(path, {"content_view_definition": cvd})[1]
Ejemplo n.º 7
0
 def repos_by_org_env(self, orgName, envId, includeDisabled=False, viewId=None):
     data = {
         "include_disabled": includeDisabled
     }
     update_dict_unless_none(data, "content_view_id", viewId)
     path = "/api/organizations/%s/environments/%s/repositories" % (orgName, envId)
     result_list = self.server.GET(path, data)[1]
     return result_list
Ejemplo n.º 8
0
    def create(self, orgId, name, label, description, priorId):
        envdata = {"name": name}
        envdata = update_dict_unless_none(envdata, "label", label)
        envdata = update_dict_unless_none(envdata, "description", description)
        envdata = update_dict_unless_none(envdata, "prior", priorId)

        path = "/api/organizations/%s/environments/" % orgId
        return self.server.POST(path, {"environment": envdata})[1]
Ejemplo n.º 9
0
    def update(self, org_id, system_group_id, name, description, max_systems):
        data = {}
        data = update_dict_unless_none(data, "name", name)
        data = update_dict_unless_none(data, "description", description)
        data = update_dict_unless_none(data, "max_systems", max_systems)
        data = { "system_group" : data }

        path = "/api/organizations/%s/system_groups/%s" % (org_id, system_group_id)
        return self.server.PUT(path, data)[1]
Ejemplo n.º 10
0
    def update(self, orgId, envId, name, description, priorId):

        envdata = {}
        envdata = update_dict_unless_none(envdata, "name", name)
        envdata = update_dict_unless_none(envdata, "description", description)
        envdata = update_dict_unless_none(envdata, "prior", priorId)

        path = "/api/organizations/%s/environments/%s" % (orgId, envId)
        return self.server.PUT(path, {"environment": envdata})[1]
Ejemplo n.º 11
0
    def update(self, provId, name, description=None, url=None):

        provdata = {}
        provdata = update_dict_unless_none(provdata, "name", name)
        provdata = update_dict_unless_none(provdata, "description", description)
        provdata = update_dict_unless_none(provdata, "repository_url", url)

        path = "/api/providers/%s" % u_str(provId)
        return self.server.PUT(path, {"provider": provdata})[1]
Ejemplo n.º 12
0
    def clone(self, org, cvd_id, name, label=None, description=None):
        cvd = dict(id=cvd_id)
        cvd = update_dict_unless_none(cvd, "name", name)
        cvd = update_dict_unless_none(cvd, "label", label)
        cvd = update_dict_unless_none(cvd, "description", description)

        path = "/api/organizations/%s/content_view_definitions/%s/clone" % \
            (org, cvd_id)
        return self.server.POST(path, dict(content_view_definition=cvd))[1]
Ejemplo n.º 13
0
    def update(self, org_id, plan_id, name, sync_date, interval, description):
        data = {}
        data = update_dict_unless_none(data, "name", name)
        data = update_dict_unless_none(data, "description", description)
        data = update_dict_unless_none(data, "interval", interval)
        data = update_dict_unless_none(data, "sync_date", sync_date)

        path = "/api/organizations/%s/sync_plans/%s" % (u_str(org_id), u_str(plan_id))
        return self.server.PUT(path, {"sync_plan": data})[1]
Ejemplo n.º 14
0
    def create(self, envId, name, description, usage_limit=-1, view_id=None):
        keyData = {
            "name": name,
            "description": description,
            "usage_limit": usage_limit
        }
        update_dict_unless_none(keyData, "content_view_id", view_id)

        path = "/api/environments/%s/activation_keys/" % envId
        return self.server.POST(path, {'activation_key': keyData})[1]
Ejemplo n.º 15
0
    def update(self, orgId, keyId, environmentId, name, description, usage_limit, view_id):
        keyData = {}
        keyData = update_dict_unless_none(keyData, "environment_id", environmentId)
        keyData = update_dict_unless_none(keyData, "name", name)
        keyData = update_dict_unless_none(keyData, "description", description)
        keyData = update_dict_unless_none(keyData, "usage_limit", usage_limit)
        keyData = update_dict_unless_none(keyData, "content_view_id", view_id)

        path = "/api/organizations/%s/activation_keys/%s/" % (orgId, keyId)

        return self.server.PUT(path, {'activation_key': keyData})[1]
Ejemplo n.º 16
0
    def repos_by_env_product(self, envId, productId, name=None, includeDisabled=False, viewId=None):
        path = "/api/environments/%s/products/%s/repositories" % (envId, productId)

        search_params = {
            "include_disabled": includeDisabled
        }
        if name != None:
            search_params['name'] = name
        update_dict_unless_none(search_params, "content_view_id", viewId)

        result_list = self.server.GET(path, search_params)[1]
        return result_list
Ejemplo n.º 17
0
    def create(self, orgName, prod_id, name, label, url, gpgkey, nogpgkey):
        repodata = {
                    "organization_id": orgName,
                    "product_id": prod_id,
                    "name": name,
                    "label": label,
                    "url": url}
        update_dict_unless_none(repodata, "gpg_key_name", gpgkey)
        if nogpgkey:
            repodata["gpg_key_name"] = ""

        path = "/api/repositories/"
        return self.server.POST(path, repodata)[1]
Ejemplo n.º 18
0
    def update(self, tplId, newName, description, parentId):

        tplData = {}
        tplData = update_dict_unless_none(tplData, "name", newName)
        tplData = update_dict_unless_none(tplData, "description", description)
        tplData = update_dict_unless_none(tplData, "parent_id", parentId)

        tplData = {
            "template": tplData
        }

        path = "/api/templates/%s" % u_str(tplId)
        return self.server.PUT(path, tplData)[1]
Ejemplo n.º 19
0
    def update(self, user_id, pw, email, disabled, default_environment, default_locale=None):
        userdata = {}
        userdata = update_dict_unless_none(userdata, "password", pw)
        userdata = update_dict_unless_none(userdata, "email", email)
        userdata = update_dict_unless_none(userdata, "disabled", disabled)

        if default_environment is None:
            userdata.update(default_environment_id=None)                        # pylint: disable=E1101
        elif default_environment is not False:
            userdata.update(default_environment_id=default_environment['id'])   # pylint: disable=E1101

        if default_locale is not None:
            userdata = update_dict_unless_none(userdata, "default_locale", default_locale)

        path = "/api/users/%s" % u_str(user_id)
        return self.server.PUT(path, {"user": userdata})[1]
Ejemplo n.º 20
0
    def update(self, name, description):

        orgdata = {}
        orgdata = update_dict_unless_none(orgdata, "description", description)

        path = "/api/organizations/%s" % u_str(name)
        return self.server.PUT(path, {"organization": orgdata})[1]
Ejemplo n.º 21
0
    def create(self, org_id, name, label, description):
        cvd = {"label": label, "name": name}
        cvd = update_dict_unless_none(cvd, "description", description)

        path = "/api/organizations/%s/content_view_definitions/" % org_id
        params = {"content_view_definition": cvd}
        return self.server.POST(path, params)[1]
Ejemplo n.º 22
0
    def create(self, org_id, name, label, description, composite=False):
        cvd = {"label": label, "name": name}
        cvd = update_dict_unless_none(cvd, "description", description)
        if composite and composite != False:
            cvd["composite"] = True

        path = "/api/organizations/%s/content_view_definitions/" % org_id
        params = {"content_view_definition": cvd}
        return self.server.POST(path, params)[1]
Ejemplo n.º 23
0
    def create(self, name, orgName, description=None, pType=None, url=None):
        provdata = {
            "provider": {
                "name": name,
                "description": description,
                "provider_type": pType
            },
            "organization_id": orgName
        }
        provdata["provider"] = update_dict_unless_none(provdata["provider"], "repository_url", url)

        path = "/api/providers/"
        return self.server.POST(path, provdata)[1]
Ejemplo n.º 24
0
    def create(self, envId, name, description, parentId):
        tplData = {
            "name": name,
            "description": description
        }
        tplData = update_dict_unless_none(tplData, "parent_id", parentId)
        tplData = {
            "template": tplData,
            "environment_id": envId
        }

        path = "/api/templates/"
        return self.server.POST(path, tplData)[1]
Ejemplo n.º 25
0
 def views_by_label_name_or_id(self, org_id, label=None, name=None, vid=None):
     params = {}
     update_dict_unless_none(params, "name", name)
     update_dict_unless_none(params, "label", label)
     update_dict_unless_none(params, "id", vid)
     path = "/api/organizations/%s/content_views" % org_id
     views = self.server.GET(path, params)[1]
     return views
Ejemplo n.º 26
0
 def product_by_name_or_label_or_id(self, orgName, prodName, prodLabel, prodId):
     params = {}
     update_dict_unless_none(params, "name", prodName)
     update_dict_unless_none(params, "label", prodLabel)
     update_dict_unless_none(params, "cp_id", prodId)
     path = "/api/organizations/%s/products" % u_str(orgName)
     products = self.server.GET(path, params)[1]
     return products
Ejemplo n.º 27
0
    def available_pools(self, system_id, match_system=False, match_installed=False, no_overlap=False):
        params = {}
        update_dict_unless_none(params, "match_system", match_system)
        update_dict_unless_none(params, "match_installed", match_installed)
        update_dict_unless_none(params, "no_overlap", no_overlap)

        path = "/api/systems/%s/pools" % system_id

        return self.server.GET(path, params)[1]
Ejemplo n.º 28
0
 def cvd_by_label_or_name_or_id(self, org_id, label=None, name=None,
                                cvd_id=None):
     path = "/api/organizations/%s/content_view_definitions/" % org_id
     params = {}
     update_dict_unless_none(params, "name", name)
     update_dict_unless_none(params, "label", label)
     update_dict_unless_none(params, "id", cvd_id)
     defs = self.server.GET(path, params)[1]
     return defs
Ejemplo n.º 29
0
    def tasks(self, org_name, environment_id, system_name = None, system_uuid = None):
        params = {}
        update_dict_unless_none(params, "environment_id", environment_id)
        if system_name:
            update_dict_unless_none(params, "system_name", system_name)
        if system_uuid:
            update_dict_unless_none(params, "system_uuid", system_uuid)

        path = "/api/organizations/%s/systems/tasks" % org_name
        return self.server.GET(path, params)[1]
Ejemplo n.º 30
0
    def update(self, orgName, prodId, description, gpgkey, nogpgkey, gpgkey_recursive):
        product = {}
        update_dict_unless_none(product, "description", description)
        update_dict_unless_none(product, "gpg_key_name", gpgkey)
        update_dict_unless_none(product, "recursive", gpgkey_recursive)
        if nogpgkey:
            product["gpg_key_name"] = ""

        path = "/api/organizations/%s/products/%s/" % (u_str(orgName), u_str(prodId))
        result = self.server.PUT(path, {"product": product})[1]
        return result
Ejemplo n.º 31
0
    def available_pools(self,
                        system_id,
                        match_system=False,
                        match_installed=False,
                        no_overlap=False):
        params = {}
        update_dict_unless_none(params, "match_system", match_system)
        update_dict_unless_none(params, "match_installed", match_installed)
        update_dict_unless_none(params, "no_overlap", no_overlap)

        path = "/api/systems/%s/pools" % system_id

        return self.server.GET(path, params)[1]
Ejemplo n.º 32
0
    def update(self, orgName, prodId, description, gpgkey, nogpgkey,
               gpgkey_recursive):
        product = {}
        update_dict_unless_none(product, "description", description)
        update_dict_unless_none(product, "gpg_key_name", gpgkey)
        update_dict_unless_none(product, "recursive", gpgkey_recursive)
        if nogpgkey:
            product["gpg_key_name"] = ""

        path = "/api/organizations/%s/products/%s/" % (u_str(orgName),
                                                       u_str(prodId))
        result = self.server.PUT(path, {"product": product})[1]
        return result
Ejemplo n.º 33
0
    def tasks(self,
              org_name,
              environment_id,
              system_name=None,
              system_uuid=None):
        params = {}
        update_dict_unless_none(params, "environment_id", environment_id)
        if system_name:
            update_dict_unless_none(params, "system_name", system_name)
        if system_uuid:
            update_dict_unless_none(params, "system_uuid", system_uuid)

        path = "/api/organizations/%s/systems/tasks" % org_name
        return self.server.GET(path, params)[1]
Ejemplo n.º 34
0
 def add_ldap_group(self, role_id, group_name):
     data = {}
     data = update_dict_unless_none(data, "name", group_name)
     path = "/api/roles/%s/ldap_groups/" % u_str(role_id)
     return self.server.POST(path, data)[1]
Ejemplo n.º 35
0
 def update(self, role_id, name, desc):
     data = {}
     data = update_dict_unless_none(data, "name", name)
     data = update_dict_unless_none(data, "description", desc)
     path = "/api/roles/%s" % u_str(role_id)
     return self.server.PUT(path, {"role": data})[1]
Ejemplo n.º 36
0
 def available_verbs(self, orgName):
     data = {}
     data = update_dict_unless_none(data, "organization_id", orgName)
     path = "/api/roles/available_verbs/"
     return self.server.GET(path, data)[1]
Ejemplo n.º 37
0
 def errata(self, org_id, system_group_id, type_in=None):
     path = "/api/organizations/%s/system_groups/%s/errata" % (
         org_id, system_group_id)
     params = {}
     update_dict_unless_none(params, "type", type_in)
     return self.server.GET(path, params)[1]