def entry_point(): """ Entry point that pulp platform uses to load the distributor :return: distributor class and its config :rtype: Distributor, dict """ return DebDistributor, read_json_config(CONF_FILE_PATH)
def entry_point(): """ Entry point that pulp platform uses to load the importer :return: importer class and its config :rtype: Importer, dict """ config = read_json_config(constants.IMPORTER_CONFIG_FILE_PATH) return WebImporter, config
def entry_point(): """ This method allows us to announce this importer to the Pulp Platform. :return: importer class as its config :rtype: tuple """ return ISOImporter, config_utils.read_json_config(CONF_FILENAME)
def entry_point(): """ Entry point that pulp platform uses to load the importer :return: importer class and its config :rtype: Importer, dict """ plugin_config = read_json_config(constants.IMPORTER_CONFIG_RELATIVE_PATH) return OpenstackImageImporter, plugin_config
def test_read_json_config(self, mock_open, exists): exists.return_value = True mock_open.return_value.read.return_value = '{"foo":"bar"}' config = read_json_config("server/foo") mock_open.assert_called_once_with('/etc/pulp/server/foo', 'r') self.assertEqual(config, {'foo': 'bar'})
def entry_point(): """ This method allows us to announce this importer to the Pulp Platform. :return: importer class as its config :rtype: tuple """ return ISOImporter, config_utils.read_json_config(CONF_FILENAME)
def entry_point(): """ Entry point that pulp platform uses to load the importer :return: importer class and its config :rtype: Importer, dict """ config = read_json_config(constants.IMPORTER_CONFIG_FILE_PATH) return WebImporter, config
def entry_point(): """ Entry point that pulp platform uses to load the importer :return: importer class and its config :rtype: Importer, {} """ plugin_config = read_json_config(CONF_FILENAME) return PuppetModuleImporter, plugin_config
def entry_point(): """ Entry point that pulp platform uses to load the importer :return: importer class and its config :rtype: Importer, {} """ plugin_config = read_json_config(CONF_FILENAME) return PuppetModuleImporter, plugin_config
def entry_point(): """ Entry point that pulp platform uses to load the importer :return: importer class and its config :rtype: Importer, dict """ plugin_config = read_json_config(constants.IMPORTER_CONFIG_FILE_NAME) return DockerImporter, plugin_config
def entry_point(): """ Entry point that pulp platform uses to load the importer :return: importer class and its config :rtype: Importer, dict """ plugin_config = read_json_config(constants.IMPORTER_CONFIG_RELATIVE_PATH) return OpenstackImageImporter, plugin_config
def test_read_json_config(self, mock_open, exists): exists.return_value = True mock_open.return_value.read.return_value = '{"foo":"bar"}' config = read_json_config("server/foo") mock_open.assert_called_once_with('/etc/pulp/server/foo', 'r') self.assertEqual(config, {'foo': 'bar'})
def entry_point(): """ Entry point that pulp platform uses to load the importer :return: importer class and its config :rtype: Importer, dict """ plugin_config = read_json_config(constants.IMPORTER_CONFIG_FILE_NAME) return DockerImporter, plugin_config
def entry_point(): """ Entry point that pulp platform uses to load the distributor :return: distributor class and its config :rtype: Distributor, dict """ plugin_config = copy.deepcopy(PLUGIN_DEFAULT_CONFIG) edited_config = read_json_config(constants.DISTRIBUTOR_CONFIG_FILE_PATH) plugin_config.update(edited_config) return WebDistributor, plugin_config
def entry_point(): """ Entry point that pulp platform uses to load the distributor :return: distributor class and its config :rtype: Distributor, dict """ plugin_config = copy.deepcopy(PLUGIN_DEFAULT_CONFIG) edited_config = read_json_config(constants.DISTRIBUTOR_CONFIG_FILE_PATH) plugin_config.update(edited_config) return WebDistributor, plugin_config
def test_read_json_config_prepended_slash_in_path(self, mock_open, exists): exists.return_value = True mock_open.return_value.read.return_value = '{"foo":"bar"}' read_json_config("/server/foo") mock_open.assert_called_once_with('/etc/pulp/server/foo', 'r')
def entry_point(): config = read_json_config(CONF_FILE_PATH) return ISORsyncDistributor, config
def entry_point(): config = read_json_config(CONF_FILE_PATH) return GroupISODistributor, config
def test_read_json_config_non_existent_file(self): config = read_json_config("bad/file/name") self.assertEqual(config, {})
from pulp.plugins.config import PluginCallConfiguration from pulp.server.db.connection import get_collection from pulp.server.managers.repo import _common as common_utils from pulp_rpm.plugins.distributors.yum.publish import Publisher YUM_DISTRIBUTOR_ID = 'yum_distributor' REPO_WORKING_DIR = '/var/lib/pulp/working/%s/distributors/' + YUM_DISTRIBUTOR_ID OLD_ROOT_PUBLISH_DIR = '/var/lib/pulp/published' OLD_HTTP_PUBLISH_DIR = os.path.join(OLD_ROOT_PUBLISH_DIR, 'http', 'repos') OLD_HTTPS_PUBLISH_DIR = os.path.join(OLD_ROOT_PUBLISH_DIR, 'https', 'repos') NEW_DISTRIBUTOR_CONF_FILE_PATH = 'server/plugins.conf.d/%s.json' % YUM_DISTRIBUTOR_ID NEW_DISTRIBUTOR_CONF = read_json_config(NEW_DISTRIBUTOR_CONF_FILE_PATH) def migrate(*args, **kwargs): """ For each repository with a yum distributor, clean up the old yum distributor's mess and re-publish the repository with the new distributor. """ distributor_collection = get_collection('repo_distributors') yum_distributors = list(distributor_collection.find({'distributor_type_id': YUM_DISTRIBUTOR_ID})) repo_collection = get_collection('repos') repo_ids = list(set(d['repo_id'] for d in yum_distributors)) repos = dict((r['id'], r) for r in repo_collection.find({'id': {'$in': repo_ids}}))
from pulp.server import config as pulp_config from pulp.server.db.connection import get_collection from pulp.server.managers.repo import _common as common_utils from pulp_rpm.plugins.distributors.yum.publish import Publisher YUM_DISTRIBUTOR_ID = 'yum_distributor' REPO_WORKING_DIR = '/var/lib/pulp/working/%s/distributors/' + YUM_DISTRIBUTOR_ID OLD_ROOT_PUBLISH_DIR = '/var/lib/pulp/published' OLD_HTTP_PUBLISH_DIR = os.path.join(OLD_ROOT_PUBLISH_DIR, 'http', 'repos') OLD_HTTPS_PUBLISH_DIR = os.path.join(OLD_ROOT_PUBLISH_DIR, 'https', 'repos') NEW_DISTRIBUTOR_CONF_FILE_PATH = 'server/plugins.conf.d/%s.json' % YUM_DISTRIBUTOR_ID NEW_DISTRIBUTOR_CONF = read_json_config(NEW_DISTRIBUTOR_CONF_FILE_PATH) def migrate(*args, **kwargs): """ For each repository with a yum distributor, clean up the old yum distributor's mess and re-publish the repository with the new distributor. """ if not api._is_initialized(): api.initialize() distributor_collection = get_collection('repo_distributors') yum_distributors = list( distributor_collection.find( {'distributor_type_id': YUM_DISTRIBUTOR_ID}))
def test_read_json_config_non_existent_file(self): config = read_json_config("bad/file/name") self.assertEqual(config, {})
def entry_point(): config = read_json_config(CONF_FILE_PATH) return ISORsyncDistributor, config
def test_read_json_config_prepended_slash_in_path(self, mock_open, exists): exists.return_value = True mock_open.return_value.read.return_value = '{"foo":"bar"}' read_json_config("/server/foo") mock_open.assert_called_once_with('/etc/pulp/server/foo', 'r')
def entry_point(): return WinImporter, config_utils.read_json_config(CONF_FILENAME)
def entry_point(): config = read_json_config(CONF_FILE_PATH) return YumHTTPDistributor, config
def entry_point(): return WinImporter, config_utils.read_json_config(CONF_FILENAME)
import logging import os from pulp.common.config import read_json_config from pulp_rpm.plugins.distributors.yum import configuration from pulp_rpm.common.ids import TYPE_ID_DISTRIBUTOR_YUM _logger = logging.getLogger(__name__) CONF_FILE_PATH = 'server/plugins.conf.d/%s.json' % TYPE_ID_DISTRIBUTOR_YUM config = read_json_config(CONF_FILE_PATH) def walk_and_clean_directories(base_directory): """ Walk through all of the directories inside of the base dir and clean the orphaned directories. The leaves should be directories with a listing file and a symlink. If there is no symlink, the directory is part of the relative url of a repo that has been deleted and it should be removed. :param base_directory: directory to search for orphaned directories :type base_directory: str :raises: OSError can occur if migration occurs durring a concurrent publish """ for path, dirs, files in os.walk(base_directory): is_orphan = not dirs and (files == ['listing'] or files == []) if is_orphan and path != base_directory:
def entry_point(): config = read_json_config(CONF_FILE_PATH) return YumHTTPDistributor, config
def entry_point(): """default entry point to initialize the DistributionHook class""" config = read_json_config(CONF_FILE_PATH) return DistributionHook, config