Ejemplo n.º 1
0
def process_manifest_for_key(manifest, manifest_key, parentcatalogs=None):
    """
    Process keys in manifests to get the lists of items to install and remove.

    Can be recursive if manifests include other manifests.
    Probably doesn't handle circular manifest references well.

    manifest can be a path to a manifest file or a dictionary object.
    """
    if isinstance(manifest, basestring):  # NOQA
        display.display_debug1(
            "** Processing manifest %s for %s" %
            (os.path.basename(manifest), manifest_key))
        manifestdata = manifestutils.get_manifest_data(manifest)
    else:
        manifestdata = manifest
        manifest = 'embedded manifest'

    cataloglist = manifestdata.get('catalogs')
    if cataloglist:
        catalogs.get_catalogs(cataloglist)
    elif parentcatalogs:
        cataloglist = parentcatalogs

    if not cataloglist:
        display.display_warning('Manifest %s has no catalogs', manifest)
        return

    for item in manifestdata.get('included_manifests', []):
        nestedmanifestpath = manifestutils.get_manifest(item)
        if not nestedmanifestpath:
            raise manifestutils.ManifestException
        process_manifest_for_key(nestedmanifestpath, manifest_key, cataloglist)
    return (cataloglist, manifestdata.get(manifest_key, []))
Ejemplo n.º 2
0
def process_manifest_for_key(manifest, manifest_key, parentcatalogs=None):
    """
    Process keys in manifests to get the lists of items to install and remove.

    Can be recursive if manifests include other manifests.
    Probably doesn't handle circular manifest references well.

    manifest can be a path to a manifest file or a dictionary object.
    """
    if isinstance(manifest, basestring):  # NOQA
        display.display_debug1("** Processing manifest %s for %s" %
                               (os.path.basename(manifest), manifest_key))
        manifestdata = manifestutils.get_manifest_data(manifest)
    else:
        manifestdata = manifest
        manifest = 'embedded manifest'

    cataloglist = manifestdata.get('catalogs')
    if cataloglist:
        catalogs.get_catalogs(cataloglist)
    elif parentcatalogs:
        cataloglist = parentcatalogs

    if not cataloglist:
        display.display_warning('Manifest %s has no catalogs', manifest)
        return

    for item in manifestdata.get('included_manifests', []):
        nestedmanifestpath = manifestutils.get_manifest(item)
        if not nestedmanifestpath:
            raise manifestutils.ManifestException
        process_manifest_for_key(nestedmanifestpath, manifest_key, cataloglist)
    return (cataloglist, manifestdata.get(manifest_key, []))
Ejemplo n.º 3
0
 def test_display_warning_with_str_msg_str_arg(self):
     display.display_warning(MSG_STR, ARG_STR)
Ejemplo n.º 4
0
 def test_display_warning_with_str_msg_unicode_arg(self):
     display.display_warning(MSG_STR, ARG_UNI)
Ejemplo n.º 5
0
 def test_display_warning_with_unicode_msg(self):
     display.display_warning(MSG_UNI)
Ejemplo n.º 6
0
 def test_display_warning_with_str_msg_str_arg(self):
     display.display_warning(MSG_STR, ARG_STR)
Ejemplo n.º 7
0
 def test_display_warning_with_str_msg_unicode_arg(self):
     display.display_warning(MSG_STR, ARG_UNI)
Ejemplo n.º 8
0
 def test_display_warning_with_unicode_msg(self):
     display.display_warning(MSG_UNI)