Пример #1
0
def main(args, parser, subparser):

    from scif.main import ScifRecipe

    # Inspect choices, r, e, l, a
    choices = [
        "r",
        "e",
        "l",
        "a",
        "f",
        "i",
        "h",
        "dump",
        "labels",
        "all",
        "files",
        "help",
        "install",
        "environment",
        "definition",
        "runscript",
    ]

    attributes = [x for x in args.attributes if x in choices]

    write_recipe = False
    if "dump" in attributes:
        write_recipe = True
        attributes.pop(attributes.index("dump"))

    apps = [x for x in args.attributes if x not in attributes]

    # First instantiate the client
    client = ScifRecipe(quiet=True, writable=False)

    # Filter down to apps that we want
    if len(apps) == 0:
        apps = client.apps()

    if len(attributes) == 0:
        attributes = ["a"]

    result = {}
    for app in apps:

        inspection = client.inspect(app, attributes)
        if len(inspection) > 0:
            result[app] = inspection

    if write_recipe is True:
        for app, atts in result.items():
            for key, val in atts.items():
                print("%" + key)
                print("\n".join(val) + "\n")
    else:
        print(json.dumps(result, indent=4, separators=(",", ": ")))
Пример #2
0
def main(args, parser, subparser):

    from scif.main import ScifRecipe

    client = ScifRecipe(quiet=True, writable=False)
    apps = client.apps()

    for app in apps:
        inspection = client.inspect(app)
        if len(inspection) > 0:
            for key, val in inspection.items():
                print('%' + key)
                print('\n'.join(val) + '\n')
Пример #3
0
def main(args,parser,subparser):

    from scif.main import ScifRecipe

    # Inspect choices, r, e, l, a
    choices = ['r', 'e', 'l', 'a', 'f', 'i', 'h', 'dump',
               'labels', 'all', 'files', "help", "install",
               'environment', 'definition', 'runscript'] 

    attributes = [x for x in args.attributes if x in choices]

    write_recipe = False
    if "dump" in attributes:
        write_recipe = True
        attributes.pop(attributes.index('dump'))

    apps = [x for x in args.attributes if x not in attributes]
    
    # First instantiate the client
    client = ScifRecipe(quiet=True, writable=False)

    # Filter down to apps that we want
    if len(apps) == 0:
        apps = client.apps()

    if len(attributes) == 0:
        attributes = ['a']

    result = {}
    for app in apps:

        inspection = client.inspect(app, attributes)
        if len(inspection) > 0:
            result[app] = inspection 

    if write_recipe is True:
        for app, atts in result.items():
            for key,val in atts.items():
                print('%' + key)
                print('\n'.join(val) + '\n')
    else:
        print(json.dumps(result,
                         indent=4,
                         separators=(',', ': ')))