예제 #1
0
def entry_point():
    """
    Entry point that pulp platform uses to load the importer.
    :return: importer class and its configuration
    :rtype:  Importer, dict
    """
    with open(CONFIGURATION_PATH) as fp:
        return NodesHttpImporter, json.load(fp)
예제 #2
0
파일: distributor.py 프로젝트: nbetm/pulp
def entry_point():
    """
    Entry point that pulp platform uses to load the distributor.
    :return: distributor class and its configuration.
    :rtype:  Distributor, dict
    """
    with open(CONFIGURATION_PATH) as fp:
        return NodesHttpDistributor, json.load(fp)
예제 #3
0
def entry_point():
    """
    Entry point that pulp platform uses to load the distributor.
    :return: distributor class and its configuration.
    :rtype:  Distributor, dict
    """
    with open(CONFIGURATION_PATH) as fp:
        return NodesHttpDistributor, json.load(fp)
예제 #4
0
def entry_point():
    """
    Entry point that pulp platform uses to load the importer.
    :return: importer class and its configuration
    :rtype:  Importer, dict
    """
    with open(CONFIGURATION_PATH) as fp:
        return NodesHttpImporter, json.load(fp)
예제 #5
0
파일: manifest.py 프로젝트: hennessy80/pulp
 def read(self):
     """
     Read the manifest file at the specified path.
     The manifest is updated using the contents of the read json document.
     :raise IOError: on I/O errors.
     :raise ValueError: on json decoding errors
     """
     with open(self.path) as fp:
         d = json.load(fp)
         self.__dict__.update(d)
예제 #6
0
파일: manifest.py 프로젝트: fdammeke/pulp
 def read(self, migration=None):
     """
     Read the manifest file at the specified path.
     The manifest is updated using the contents of the read json document.
     :param migration: Migration function used to migrate the document.
     :type migration: callable
     :raise IOError: on I/O errors.
     :raise ValueError: on json decoding errors
     """
     if migration:
         migration(self.path)
     with open(self.path) as fp:
         d = json.load(fp)
         self.__dict__.update(d)
예제 #7
0
 def read(self, path=None):
     """
     Read the manifest file at the specified path.
     The manifest is updated using the contents of the read json document.
     :param path: An optional path to the manifest.
     :type path: str
     :raise IOError: on I/O errors.
     :raise ValueError: on json decoding errors
     """
     with open(path or self.path) as fp:
         d = json.load(fp)
     self.id = d.get(ID)
     self.version = d.get(VERSION, 0)
     self.units = d.get(UNITS, {UNITS_PATH: None, UNITS_TOTAL: 0, UNITS_SIZE: 0})
     self.publishing_details = d.get(PUBLISHING_DETAILS, {})
예제 #8
0
파일: migration.py 프로젝트: fdammeke/pulp
def migrate(path):
    """
    Migrate to latest version.
    :param path: The path to a stored manifest.
    :type: path: str
    """
    with open(path) as fp:
        manifest = json.load(fp)
    version_in = manifest[VERSION]
    for version in range(version_in, _manifest.MANIFEST_VERSION):
        migration = MIGRATIONS[version]
        manifest = migration(manifest)
        manifest[VERSION] = version + 1
    if version_in < manifest[VERSION]:
        with open(path, 'w+') as fp:
            json.dump(manifest, fp)
예제 #9
0
 def read(self, path=None):
     """
     Read the manifest file at the specified path.
     The manifest is updated using the contents of the read json document.
     :param path: An optional path to the manifest.
     :type path: str
     :raise IOError: on I/O errors.
     :raise ValueError: on json decoding errors
     """
     with open(path or self.path) as fp:
         d = json.load(fp)
     self.id = d.get(ID)
     self.version = d.get(VERSION, 0)
     self.units = d.get(UNITS, {
         UNITS_PATH: None,
         UNITS_TOTAL: 0,
         UNITS_SIZE: 0
     })
     self.publishing_details = d.get(PUBLISHING_DETAILS, {})