コード例 #1
0
ファイル: command_login.py プロジェクト: ravello/testmill
def do_login(args, env):
    """The "ravello login" command."""
    username = args.username or args.user
    password = args.password
    if username is None:
        console.writeln('Enter your Ravello credentials.')
    if username is None:
        username = console.prompt('Username: '******'Password: '******'Successfully logged in.')
    return 0
コード例 #2
0
ファイル: fabric.py プロジェクト: ravello/testmill
def _setup_testmill():
    """Set up or re-sync a TestMill "env" from a Fabric "env". Also set some
    useful defaults in the Fabric environment for using TestMill.

    In essense this is a bridge between Fabric and the TestMill package.
    """
    env.quiet = False
    env.verbose = fab.output.debug
    env.manifest = None
    env.debug = fab.output.debug
    env.always_confirm = False
    if not hasattr(fab.env, 'ravello_user'):
        fab.env.ravello_user = '******'
    if not hasattr(fab.env, 'ravello_api_user'):
        fab.env.ravello_api_user = None
    if not hasattr(fab.env, 'ravello_api_password'):
        fab.env.ravello_api_password = None
    if not hasattr(fab.env, 'ravello_api_url'):
        fab.env.ravello_api_url = None
    if not hasattr(env, 'api'):
        main.setup_logging()
        env.service_url = fab.env.ravello_api_url
        env.api = ravello.RavelloClient(service_url=env.service_url)
        try:
            login.token_login()
        except error.ProgramError:
            if not fab.env.ravello_api_user:
                msg = 'Please enter your Ravello username: '******'Please enter your Ravello password: '******'public_key'):
        keypair.default_keypair()
        key_filename = env.private_key_file
        if fab.env.key_filename is None:
            fab.env.key_filename = key_filename
        elif isinstance(fab.env, compat.str):
            fab.env.key_filename = [fab.env.key_filename, key_filename]
        elif isinstance(fab.env, list):
            fab.env.key_filename.append(key_filename)