예제 #1
0
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)
예제 #2
0
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
예제 #3
0
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)
예제 #4
0
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
예제 #5
0
    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'})
예제 #6
0
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)
예제 #7
0
파일: web.py 프로젝트: beav/pulp_deb
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
예제 #8
0
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
예제 #9
0
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
예제 #10
0
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
예제 #11
0
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'})
예제 #13
0
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
예제 #14
0
파일: web.py 프로젝트: pcreech/pulp_ostree
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
예제 #15
0
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')
예제 #17
0
def entry_point():
    config = read_json_config(CONF_FILE_PATH)
    return ISORsyncDistributor, config
예제 #18
0
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}}))
예제 #21
0
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}))
예제 #22
0
 def test_read_json_config_non_existent_file(self):
     config = read_json_config("bad/file/name")
     self.assertEqual(config, {})
예제 #23
0
def entry_point():
    config = read_json_config(CONF_FILE_PATH)
    return ISORsyncDistributor, config
예제 #24
0
 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')
예제 #25
0
def entry_point():
    return WinImporter, config_utils.read_json_config(CONF_FILENAME)
예제 #26
0
def entry_point():
    config = read_json_config(CONF_FILE_PATH)
    return YumHTTPDistributor, config
예제 #27
0
def entry_point():
    return WinImporter, config_utils.read_json_config(CONF_FILENAME)
예제 #28
0
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:
예제 #29
0
def entry_point():
    config = read_json_config(CONF_FILE_PATH)
    return YumHTTPDistributor, config
예제 #30
0
def entry_point():
    """default entry point to initialize the DistributionHook class"""
    config = read_json_config(CONF_FILE_PATH)
    return DistributionHook, config