Пример #1
0
def run_container_diff(container, dest, files=True):
    ''' a wrapper around container diff.
    '''

    cmd = ['container-diff', 'analyze', '--json']
    if files is True:
        cmd.append('--type=file')

    cmd = cmd + [container]
    stdout, stderr = Client._run_command(cmd)

    with open(dest, 'w') as filey:
        filey.writelines(stdout)

    return dest
Пример #2
0
def run_analyze(container, dest, files=True):
    ''' a wrapper to run the command to generate the json object, calling
        analyze-singularity.sh that should be on the path, and renaming
        to the file wanted by the calling script.
    '''

    cmd = [analyze, container]
    if files is True:
        cmd.append('--type=file')
    try:
        stdout, stderr = Client._run_command(cmd)

        files = [x for x in stdout.split('\n') if x]
        output_file = files[-1]
        if os.path.exists(output_file):
            shutil.move(output_file, dest)
        return dest
    except:
        print('Problem with %s' % cmd)