Exemple #1
0
def interactive(parsed_args, headers, results, force=False):
    """Interactively solicit configuration values
    """
    context = _read_current(parsed_args)
    interactive = context['interactive'] or force

    if interactive:
        print('\nContainer registry access:')
        print('--------------------------')

    for iv in VARS:
        prompt_name = iv.replace('_', ' ').title()
        key_name = ENV_PREFIX + iv
        header_name = iv.lower()

        if interactive:
            if settings.redact.key_is_private(key_name):
                is_secret = True
            else:
                is_secret = False
            value = prompt(prompt_name, context[key_name], secret=is_secret)
        else:
            value = context[key_name]

        if value is not None and value != '':
            settings_set(key_name, value)

        headers.append(header_name)
        results.append(settings.redact.auto_redact(header_name, value))

    return (headers, results)
def firstrun():
    """First-run workflow
    """
    if not exist_firstrun():
        if settings.TAPIS_CLI_DISPLAY_AUP:
            display_aup()
        if settings.TAPIS_CLI_GA_DISABLE is False:
            if not opt_in_reporting():
                settings_set('TAPIS_CLI_GA_DISABLE', 'true')
        touch_firstrun()
Exemple #3
0
def firstrun():
    """First-run workflow
    """

    # TAPIS_CLI_NO_PROMPT allows the CLI to be run without invoking
    # the firstrun sequence. This is intended for cases such as CICD
    # usage of the CLI or for environments where the TACC AUP and
    # Tapis platform COC will never apply. It is not implemented as a
    # setting to prevent users from setting it.
    firstrun_bypass = settings.helpers.parse_boolean(
        os.environ.get('TAPIS_CLI_NO_PROMPT', '0'))

    if firstrun_bypass is False and not exist_firstrun():
        if settings.TAPIS_CLI_DISPLAY_AUP:
            display_aup()
        if settings.TAPIS_CLI_DISPLAY_COC:
            display_coc()
        if settings.TAPIS_CLI_GA_DISABLE is False:
            if not opt_in_reporting():
                settings_set('TAPIS_CLI_GA_DISABLE', 'true')
        touch_firstrun()
Exemple #4
0
def interactive(parsed_args, headers, results, force=False):
    """Interactively solicit configuration values
    """
    context = _read_current(parsed_args)
    interactive = context['interactive'] or force

    if interactive:
        print('\nGit server access:')
        print('------------------')

    for iv in VARS:
        prompt_name = iv.replace('_', ' ').title()
        key_name = ENV_PREFIX + iv
        header_name = iv.lower()

        if interactive:

            if key_name == ENV_PREFIX + 'GIT_TOKEN':
                print(
                    'Learn about {} personal access tokens:'.format(GITHUBCOM))
                print(ACCESS_TOKEN_HELP_URLS[GITHUBCOM])

            if settings.redact.key_is_private(key_name):
                is_secret = True
            else:
                is_secret = False
            value = prompt(prompt_name, context[key_name], secret=is_secret)
        else:
            value = context[key_name]

        if value is not None and value != '':
            settings_set(key_name, value)

        headers.append(header_name)
        results.append(settings.redact.auto_redact(header_name, value))

    return (headers, results)