sregistry/client/backend.py
def add(backend, variable, value, force=False):
    '''add the variable to the config
    '''
    print('[add]')
    settings = read_client_secrets()

    # If the variable begins with the SREGISTRY_<CLIENT> don't add it
    prefix = 'SREGISTRY_%s_' %backend.upper()
    if not variable.startswith(prefix):
        variable = '%s%s' %(prefix, variable)

    # All must be uppercase
    variable = variable.upper()
    bot.info("%s %s" %(variable, value))
    
    # Does the setting already exist?

    if backend in settings:
        if variable in settings[backend] and force is False:
            previous = settings[backend][variable]
            bot.error('%s is already set as %s. Use --force to override.' %(variable, previous))
            sys.exit(1)

    if backend not in settings:
        settings[backend] = {}

    settings[backend][variable] = value
    update_secrets(settings)
def add(backend, variable, value, force=False):
    '''add the variable to the config
    '''
    print('[add]')
    settings = read_client_secrets()

    # If the variable begins with the SREGISTRY_<CLIENT> don't add it
    prefix = 'SREGISTRY_%s_' %backend.upper()
    if not variable.startswith(prefix):
        variable = '%s%s' %(prefix, variable)

    # All must be uppercase
    variable = variable.upper()
    bot.info("%s %s" %(variable, value))
    
    # Does the setting already exist?

    if backend in settings:
        if variable in settings[backend] and force is False:
            previous = settings[backend][variable]
            bot.error('%s is already set as %s. Use --force to override.' %(variable, previous))
            sys.exit(1)

    if backend not in settings:
        settings[backend] = {}

    settings[backend][variable] = value
    update_secrets(settings)
def add ( backend , variable , value , force = False ) : print ( '[add]' ) settings = read_client_secrets ( ) # If the variable begins with the SREGISTRY_<CLIENT> don't add it prefix = 'SREGISTRY_%s_' % backend . upper ( ) if not variable . startswith ( prefix ) : variable = '%s%s' % ( prefix , variable ) # All must be uppercase variable = variable . upper ( ) bot . info ( "%s %s" % ( variable , value ) ) # Does the setting already exist? if backend in settings : if variable in settings [ backend ] and force is False : previous = settings [ backend ] [ variable ] bot . error ( '%s is already set as %s. Use --force to override.' % ( variable , previous ) ) sys . exit ( 1 ) if backend not in settings : settings [ backend ] = { } settings [ backend ] [ variable ] = value update_secrets ( settings )
add the variable to the config
add the variable to the config