当前位置: 首页>>代码示例>>Python>>正文


Python display.vvv方法代码示例

本文整理汇总了Python中__main__.display.vvv方法的典型用法代码示例。如果您正苦于以下问题:Python display.vvv方法的具体用法?Python display.vvv怎么用?Python display.vvv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在__main__.display的用法示例。


在下文中一共展示了display.vvv方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: service_account_update

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def service_account_update(sid, groups):
    """Update service_account groups"""
    display.vvv("DC/OS: IAM update service_account {}".format(sid))

    for g in groups:
        display.vvv("Assigning service_account {} to group {}".format(
            sid,g))

        cmd = [
            'dcos',
            'security',
            'org',
            'groups',
            'add_user',
            g,
            sid
        ]
        run_command(cmd, 'update service_account', stop_on_error=False) 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:20,代码来源:dcos_iam_serviceaccount.py

示例2: get_pool_state

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def get_pool_state(pool_id, instance_name):
    """Get the current state of a pool."""
    r = subprocess.check_output([
        'dcos',
        'edgelb',
        'list',
        '--name=' + instance_name,
        '--json'
        ], env=_dcos_path())
    pools = json.loads(r)

    display.vvv('looking for pool_id {}'.format(pool_id))

    state = 'absent'
    for p in pools:
        try:
            if pool_id in p['name']:
                state = 'present'
                display.vvv('found pool: {}'.format(pool_id))

        except KeyError:
         continue
    return state 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:25,代码来源:dcos_edgelb.py

示例3: pool_create

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def pool_create(pool_id, instance_name, options):
    """Create a pool"""
    display.vvv("DC/OS: edgelb create pool {}".format(pool_id))

    # create a temporary file for the options json file
    with tempfile.NamedTemporaryFile('w+') as f:
        json.dump(options, f)

        # force write the file to disk to make sure subcommand can read it
        f.flush()
        os.fsync(f)

        display.vvv(subprocess.check_output(
        ['cat', f.name]).decode())

        cmd = [
            'dcos',
            'edgelb',
            'create',
            '--name=' + instance_name,
            f.name
        ]
        run_command(cmd, 'update pool', stop_on_error=True) 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:25,代码来源:dcos_edgelb.py

示例4: pool_update

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def pool_update(pool_id, instance_name, options):
    """Update an pool"""
    display.vvv("DC/OS: Edgelb update pool {}".format(pool_id))

    # create a temporary file for the options json file
    with tempfile.NamedTemporaryFile('w+') as f:
        json.dump(options, f)

        # force write the file to disk to make sure subcommand can read it
        f.flush()
        os.fsync(f)

        display.vvv(subprocess.check_output(
        ['cat', f.name]).decode())

        cmd = [
            'dcos',
            'edgelb',
            'update',
            '--name=' + instance_name,
            f.name
        ]
        run_command(cmd, 'update pool', stop_on_error=True) 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:25,代码来源:dcos_edgelb.py

示例5: get_current_version

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def get_current_version(package, app_id):
    """Get the current version of an installed package."""
    r = subprocess.check_output(['dcos', 'package', 'list', '--json', '--app-id='+app_id ], env=_dcos_path())
    packages = json.loads(r)

    display.vvv('looking for package {} app_id {}'.format(package, app_id))

    v = None
    for p in packages:
        try:
            if p['name'] == package and '/' + app_id in p['apps']:
                v = p['version']
        except KeyError:
         continue
    display.vvv('{} current version: {}'.format(package, v))
    return v 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:18,代码来源:dcos_package.py

示例6: connect_cluster

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def connect_cluster(**kwargs):
    """Connect to a DC/OS cluster by url"""

    changed = False
    url = kwargs.get('url')

    if not check_cluster(kwargs.get('name'), url):
        if url is None:
            raise AnsibleActionFail(
                'Not connected: you need to specify the cluster url')

        display.vvv('DC/OS cluster not setup, setting up')

        cli_args = parse_connect_options(**kwargs)
        display.vvv('args: {}'.format(cli_args))

        subprocess.check_call(['dcos', 'cluster', 'setup', url] + cli_args, env=_dcos_path())
        changed = True

    # ensure_auth(**kwargs)
    return changed 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:23,代码来源:dcos_connection.py

示例7: ensure_dcos

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def ensure_dcos():
    """Check whether the dcos cli is installed."""

    try:
        r = subprocess.check_output(['dcos', '--version'], env=_dcos_path()).decode()
    except subprocess.CalledProcessError:
        raise AnsibleActionFail("DC/OS CLI is not installed!")

    raw_version = ''
    for line in r.strip().split('\n'):
        display.vvv(line)
        k, v = line.split('=')
        if k == 'dcoscli.version':
            raw_version = v

    v = _version(raw_version)
    if v < (0, 5, 0):
        raise AnsibleActionFail(
            "DC/OS CLI 0.5.x is required, found {}".format(v))
    if v >= (0, 7, 0):
        raise AnsibleActionFail(
            "DC/OS CLI version > 0.7.x detected, may not work")
    display.vvv("dcos: all prerequisites seem to be in order") 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:25,代码来源:common.py

示例8: ensure_dcos_security

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def ensure_dcos_security():
    """Check whether the dcos[cli] security extension is installed."""

    raw_version = ''
    try:
        r = subprocess.check_output(['dcos', 'security', '--version'], env=_dcos_path()).decode()
    except:
        display.vvv("dcos security: not installed")
        install_dcos_security_cli()
        r = subprocess.check_output(['dcos', 'security', '--version'], env=_dcos_path()).decode()

    v = _version(r)
    if v < (1, 2, 0):
        raise AnsibleActionFail(
            "DC/OS Security CLI 1.2.x is required, found {}".format(v))

    display.vvv("dcos security: all prerequisites seem to be in order") 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:19,代码来源:common.py

示例9: run_command

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def run_command(cmd, description='run command', stop_on_error=False, input=None):
    """Run a command and catch exceptions for Ansible."""
    display.vvv("command: " + ' '.join(cmd))

    from subprocess import CalledProcessError, check_output

    try:
        output = check_output(cmd, env=_dcos_path(),stderr=subprocess.STDOUT)
        #output = check_output(cmd, env=_dcos_path())
        returncode = 0
    except CalledProcessError as e:
        output = e.output
        returncode = e.returncode
        if stop_on_error and returncode != 0:
             raise AnsibleActionFail('Failed to {}: {}'.format(description, e))

    return output 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:19,代码来源:common.py

示例10: get_app_state

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def get_app_state(app_id):
    """Get the current state of an app."""
    r = subprocess.check_output(['dcos', 'marathon', 'app', 'list', '--json' ], env=_dcos_path())
    apps = json.loads(r)

    display.vvv('looking for app_id {}'.format(app_id))

    state = 'absent'
    for a in apps:
        try:
            if app_id in a['id']:
                state = 'present'
                display.vvv('found app: {}'.format(app_id))

        except KeyError:
         continue
    return state 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:19,代码来源:dcos_marathon.py

示例11: app_create

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def app_create(app_id, options):
    """Deploy an app via Marathon"""
    display.vvv("DC/OS: Marathon create app {}".format(app_id))

    # create a temporary file for the options json file
    with tempfile.NamedTemporaryFile('w+') as f:
        json.dump(options, f)

        # force write the file to disk to make sure subcommand can read it
        f.flush()
        os.fsync(f)

        display.vvv(subprocess.check_output(
        ['cat', f.name]).decode())

        cmd = [
            'dcos',
            'marathon',
            'app',
            'add',
            f.name
        ]
        run_command(cmd, 'add app', stop_on_error=True) 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:25,代码来源:dcos_marathon.py

示例12: secret_create

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def secret_create(path, value, store):
    """Create a secret"""

    display.vvv("DC/OS: create secret {} with {}".format(path, value))

    cmd = [
        'dcos',
        'security',
        'secrets',
        'create',
        '--store-id',
        store,
        '--value',
        value,
        path
    ]
    run_command(cmd, 'create secret', stop_on_error=True) 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:19,代码来源:dcos_secret.py

示例13: secret_update

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def secret_update(path, value, store):
    """Update a secret"""

    display.vvv("DC/OS: update secret {} with {}".format(path, value))

    cmd = [
        'dcos',
        'security',
        'secrets',
        'update',
        '--store-id',
        store,
        '--value',
        value,
        path
    ]
    run_command(cmd, 'update secret', stop_on_error=True) 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:19,代码来源:dcos_secret.py

示例14: group_update

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def group_update(gid, permissions):
    """Update group permissions"""
    display.vvv("DC/OS: IAM update group {}".format(gid))

    for p in permissions:
        display.vvv("Granting {} permission on {} to group {}".format(
            p['rid'], p['action'], gid))

        cmd = [
            'dcos',
            'security',
            'org',
            'groups',
            'grant',
            gid,
            p['rid'],
            p['action']
        ]
        run_command(cmd, 'update group', stop_on_error=False) 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:21,代码来源:dcos_iam_group.py

示例15: user_update

# 需要导入模块: from __main__ import display [as 别名]
# 或者: from __main__.display import vvv [as 别名]
def user_update(uid, groups):
    """Update user groups"""
    display.vvv("DC/OS: IAM update user {}".format(uid))

    for g in groups:
        display.vvv("Assigning user {} to group {}".format(
            uid,g))

        cmd = [
            'dcos',
            'security',
            'org',
            'groups',
            'add_user',
            g,
            uid
        ]
        run_command(cmd, 'update user', stop_on_error=False) 
开发者ID:mesosphere-backup,项目名称:ansible-dcos,代码行数:20,代码来源:dcos_iam_user.py


注:本文中的__main__.display.vvv方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。