Beispiel #1
0
def set_defaults(ctx, output, allow_telemetry, disable_ssl_warnings,
                 auto_approve):
    """ command """
    # Process any changed defaults
    new_defaults = {}
    for i in [{
            'key': 'output',
            'inputValue': output
    }, {
            'key': 'allowTelemetry',
            'inputValue': allow_telemetry
    }, {
            'key': 'disableSSLWarnings',
            'inputValue': disable_ssl_warnings
    }]:
        if i['inputValue'] is not None:
            new_defaults[i['key']] = i['inputValue']
    approval_confirmation_map = {'set-defaults': 'Defaults will be edited.'}
    verify_approval('set-defaults', approval_confirmation_map, auto_approve)
    # Create/update configuration file
    ctx.config_client.create_or_update(new_defaults)
    message = 'CLI defaults updated successfully.'
    if disable_ssl_warnings:
        os.environ[
            constants.ENV_VARS['DISABLE_SSL_WARNINGS']] = disable_ssl_warnings
        if disable_ssl_warnings == 'true':
            message += ' Warning: Insecure SSL warnings have been disabled'
    ctx.log(message)
Beispiel #2
0
def auth_delete(ctx, name, auto_approve):
    """ command """
    approval_confirmation_map = {
        'delete': 'Auth contents named %s will be deleted.' % name
    }
    verify_approval('delete', approval_confirmation_map, auto_approve)
    auth_client = AuthConfigurationClient()
    auth_client.delete_auth(name)
    ctx.log(f"Successfully deleted auth: {name} contents")
Beispiel #3
0
def command_do(ctx, action, version, declaration, package_url, auto_approve):
    """ command """
    approval_confirmation_map = {'uninstall': 'DO package will be uninstalled'}
    verify_approval(action, approval_confirmation_map, auto_approve)
    extension_operations_client = ExtensionOperationsClient(
        get_mgmt_client(), 'do', version, package_url)
    extension_operations_client.install_component_if_required(
        check_install(action))
    output = process_extension_component_command(extension_operations_client,
                                                 COMPONENTS['do']['actions'],
                                                 action,
                                                 declaration=declaration)
    ctx.log(output)
Beispiel #4
0
def token_delete(ctx, name, auto_approve):
    """ command """
    approval_confirmation_map = {
        'delete': 'Token named %s will be deleted' % name
    }
    utils_core.verify_approval('delete', approval_confirmation_map,
                               auto_approve)
    token_client = TokenClient(get_mgmt_client())
    result = token_client.delete(name=name, config={})
    if result == {}:
        ctx.log('Token deleted successfully')
    else:
        ctx.log(result)
Beispiel #5
0
def insight_delete(ctx, name, auto_approve):
    """ command """
    approval_confirmation_map = {
        'delete': 'Insight named %s will be deleted' % name
    }
    utils_core.verify_approval('delete', approval_confirmation_map,
                               auto_approve)
    insights_client = InsightsClient(get_mgmt_client())
    result = insights_client.delete(name=name, config={})
    if result == {}:
        ctx.log('Insight deleted successfully')
    else:
        ctx.log(result)