def create(self, name, environment, checksumtype='sha256'): repo_id = "{0}-{1}".format(name, environment) relative_url = "/{0}/{1}/".format(environment, name) checksumtype = checksumtype pulp = RepositoryAPI(self.connection) response = pulp.create_and_configure( id=repo_id, display_name=name, description=repo_id, notes={'_repo-type': 'rpm-repo'}, importer_type_id='yum_importer', importer_config={}, distributors=[{'distributor_id': 'yum_distributor', 'distributor_type_id': 'yum_distributor', 'distributor_config': { 'relative_url': relative_url, 'http': True, 'https': True, 'checksum_type': checksumtype }, 'auto_publish': True, 'relative_path': relative_url }] ) if response.response_code == Constants.PULP_POST_CREATED: Log.log_info("%s created in %s", name, environment) else: Log.log_info("failed to create %s in %s", name, environment) Log.log_debug(response)
def run(self): from pulp.bindings.repository import RepositoryAPI from pulp.bindings.repository import RepositoryActionsAPI for environment in self.args.environment: repo_id = "{0}-{1}".format(self.args.repo, environment) display_name = self.args.repo relative_url = "/{0}/{1}/".format(environment, self.args.repo) checksum_type = self.args.checksum_type pulp = RepositoryAPI(self.connections[environment]) response = pulp.create_and_configure( id=repo_id, display_name=display_name, description=repo_id, notes={'_repo-type': 'rpm-repo'}, importer_type_id='yum_importer', importer_config={}, distributors=[{ 'distributor_id': 'yum_distributor', 'distributor_type_id': 'yum_distributor', 'distributor_config': { 'relative_url': relative_url, 'http': True, 'https': True, 'checksum_type': checksum_type }, 'auto_publish': True, 'relative_path': relative_url }]) if response.response_code == Constants.PULP_POST_CREATED: Log.log_info("%s created in %s", display_name, environment) else: Log.log_info("failed to create %s in %s", display_name, environment) Log.log_debug(response) pulp = RepositoryActionsAPI(self.connections[environment]) response = pulp.publish(repo_id, 'yum_distributor', {}) if response.response_code == Constants.PULP_POST_ACCEPTED: Log.log_info("%s published in %s", display_name, environment) else: Log.log_info("failed to publish %s in %s", display_name, environment) Log.log_debug(response)
def run(self): from pulp.bindings.repository import RepositoryAPI from pulp.bindings.repository import RepositoryActionsAPI for environment in self.args.environment: repo_id = "{0}-{1}".format(self.args.repo, environment) display_name = self.args.repo relative_url = "/{0}/{1}/".format(environment, self.args.repo) checksum_type = self.args.checksum_type pulp = RepositoryAPI(self.connections[environment]) response = pulp.create_and_configure( id=repo_id, display_name=display_name, description=repo_id, notes={'_repo-type': 'rpm-repo'}, importer_type_id='yum_importer', importer_config={}, distributors=[{'distributor_id': 'yum_distributor', 'distributor_type_id': 'yum_distributor', 'distributor_config': { 'relative_url': relative_url, 'http': True, 'https': True, 'checksum_type': checksum_type }, 'auto_publish': True, 'relative_path': relative_url }] ) if response.response_code == Constants.PULP_POST_CREATED: Log.log_info("%s created in %s", display_name, environment) else: Log.log_info("failed to create %s in %s", display_name, environment) Log.log_debug(response) pulp = RepositoryActionsAPI(self.connections[environment]) response = pulp.publish(repo_id, 'yum_distributor', {}) if response.response_code == Constants.PULP_POST_ACCEPTED: Log.log_info("%s published in %s", display_name, environment) else: Log.log_info("failed to publish %s in %s", display_name, environment) Log.log_debug(response)
def create(self, name, environment, checksumtype='sha256'): repo_id = "{0}-{1}".format(name, environment) relative_url = "/{0}/{1}/".format(environment, name) checksumtype = checksumtype pulp = RepositoryAPI(self.connection) response = pulp.create_and_configure(id=repo_id, display_name=name, description=repo_id, notes={'_repo-type': 'rpm-repo'}, importer_type_id='yum_importer', importer_config={}, distributors=[{ 'distributor_id': 'yum_distributor', 'distributor_type_id': 'yum_distributor', 'distributor_config': { 'relative_url': relative_url, 'http': True, 'https': True, 'checksum_type': checksumtype }, 'auto_publish': True, 'relative_path': relative_url }]) if response.response_code == Constants.PULP_POST_CREATED: Log.log_info("%s created in %s", name, environment) else: Log.log_info("failed to create %s in %s", name, environment) Log.log_debug(response)