How to use the blackduck.HubRestApi.HubInstance.PROJECT_VERSION_SETTINGS function in blackduck

To help you get started, we’ve selected a few blackduck examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github blackducksoftware / hub-rest-api-python / blackduck / HubRestApi.py View on Github external
def update_project_version_settings(self, project_name, version_name, new_settings={}):
        # Apply any new settings to the given project version
        version = self.get_project_version_by_name(project_name, version_name)

        if version:
            for k,v in new_settings.items():
                if k in HubInstance.PROJECT_VERSION_SETTINGS:
                    logging.debug("updating setting {} in version {} with value {}".format(
                        k, version['versionName'], v))
                    version[k] = v
                else:
                    logging.warn("Setting {} is not in the list of project version settings ({})".format(
                        k, HubInstance.PROJECT_VERSION_SETTINGS))

            url = version['_meta']['href']

            response = self.execute_put(url, version)

            if response.status_code == 200:
                logging.info("Successfully updated version {} with new settings {}".format(
                    version['versionName'], new_settings))
            else:
                logging.error("Failed to update version {} with new settings {}; status code: {}".format(
                    version['versionName'], new_settings, response.status_code))
        else:
            logging.debug("Did not find a matching project-version in project {}, version name {}".format(
                project_name, version_name))
github blackducksoftware / hub-rest-api-python / blackduck / HubRestApi.py View on Github external
def update_project_version_settings(self, project_name, version_name, new_settings={}):
        # Apply any new settings to the given project version
        version = self.get_project_version_by_name(project_name, version_name)

        if version:
            for k,v in new_settings.items():
                if k in HubInstance.PROJECT_VERSION_SETTINGS:
                    logging.debug("updating setting {} in version {} with value {}".format(
                        k, version['versionName'], v))
                    version[k] = v
                else:
                    logging.warn("Setting {} is not in the list of project version settings ({})".format(
                        k, HubInstance.PROJECT_VERSION_SETTINGS))

            url = version['_meta']['href']

            response = self.execute_put(url, version)

            if response.status_code == 200:
                logging.info("Successfully updated version {} with new settings {}".format(
                    version['versionName'], new_settings))
            else:
                logging.error("Failed to update version {} with new settings {}; status code: {}".format(
github blackducksoftware / hub-rest-api-python / blackduck / HubRestApi.py View on Github external
def update_project_version_settings(self, project_name, version_name, new_settings={}):
        # Apply any new settings to the given project version
        version = self.get_project_version_by_name(project_name, version_name)

        if version:
            for k,v in new_settings.items():
                if k in HubInstance.PROJECT_VERSION_SETTINGS:
                    logging.debug("updating setting {} in version {} with value {}".format(
                        k, version['versionName'], v))
                    version[k] = v
                else:
                    logging.warn("Setting {} is not in the list of project version settings ({})".format(
                        k, HubInstance.PROJECT_VERSION_SETTINGS))

            url = version['_meta']['href']

            response = self.execute_put(url, version)

            if response.status_code == 200:
                logging.info("Successfully updated version {} with new settings {}".format(
                    version['versionName'], new_settings))
            else:
                logging.error("Failed to update version {} with new settings {}; status code: {}".format(
github blackducksoftware / hub-rest-api-python / blackduck / HubRestApi.py View on Github external
def update_project_version_settings(self, project_name, version_name, new_settings={}):
        # Apply any new settings to the given project version
        version = self.get_project_version_by_name(project_name, version_name)

        if version:
            for k,v in new_settings.items():
                if k in HubInstance.PROJECT_VERSION_SETTINGS:
                    logging.debug("updating setting {} in version {} with value {}".format(
                        k, version['versionName'], v))
                    version[k] = v
                else:
                    logging.warn("Setting {} is not in the list of project version settings ({})".format(
                        k, HubInstance.PROJECT_VERSION_SETTINGS))

            url = version['_meta']['href']

            response = self.execute_put(url, version)

            if response.status_code == 200:
                logging.info("Successfully updated version {} with new settings {}".format(
                    version['versionName'], new_settings))
            else:
                logging.error("Failed to update version {} with new settings {}; status code: {}".format(
                    version['versionName'], new_settings, response.status_code))
        else:
            logging.debug("Did not find a matching project-version in project {}, version name {}".format(
                project_name, version_name))