コード例 #1
0
ファイル: runtime_settings.py プロジェクト: biggtfish/armada
def _save_runtime_settings():
    consul_settings = {}
    consul_settings['is_commander'] = is_ship_commander()
    consul_settings['name'] = get_ship_name()
    consul_settings['ships'] = get_other_ship_ips()
    consul_settings['datacenter'] = get_current_datacenter()
    consul_settings['dockyards'] = alias.get_list()

    with open(consul_config.RUNTIME_SETTINGS_PATH, 'w') as runtime_settings:
        runtime_settings.write(json.dumps(consul_settings, sort_keys=True, indent=4))
コード例 #2
0
ファイル: runtime_settings.py プロジェクト: hunterfu/armada
def _save_runtime_settings():
    consul_settings = {}
    consul_settings['is_commander'] = is_ship_commander()
    consul_settings['name'] = get_ship_name()
    consul_settings['ships'] = get_other_ship_ips()
    consul_settings['datacenter'] = get_current_datacenter()
    consul_settings['dockyards'] = alias.get_list()

    with open(consul_config.RUNTIME_SETTINGS_PATH, 'w') as runtime_settings:
        runtime_settings.write(
            json.dumps(consul_settings, sort_keys=True, indent=4))
コード例 #3
0
ファイル: dockyard.py プロジェクト: olivierh59500/armada
def get_default_alias():
    default_alias = alias.get_default()
    if default_alias:
        dockyard = alias.get_alias(default_alias)
        if not dockyard:
            raise DockyardException('Default dockyard does not exist.')
        return default_alias
    alias_list = alias.get_list()
    if not alias_list:
        raise DockyardException('There are no running dockyards.')
    if len(alias_list) > 1:
        raise CriticalDockyardException('There are multiple running dockyards and no default set.'
                                        'Please specify dockyard by -d/--dockyard or set the default.')
    return alias_list[0]['name']
コード例 #4
0
def command_dockyard_list(args):
    output_header = ['Default', 'Alias', 'Address', 'User', 'Password']
    output_rows = [output_header]
    alias_list = alias.get_list()
    for alias_dict in alias_list:
        default_string = '->'.rjust(len(
            output_header[0])) if alias_dict['is_default'] else ''
        row = [
            default_string, alias_dict['name'], alias_dict['address'],
            alias_dict.get('user', ''),
            _hide_password(alias_dict.get('password', ''))
        ]
        output_rows.append(row)
    print_table(output_rows)
コード例 #5
0
ファイル: dockyard.py プロジェクト: labuzm/armada
def get_default_alias():
    default_alias = alias.get_default()
    if default_alias:
        dockyard = alias.get_alias(default_alias)
        if not dockyard:
            raise DockyardException('Default dockyard does not exist.')
        return default_alias
    alias_list = alias.get_list()
    if not alias_list:
        raise DockyardException('There are no running dockyards.')
    if len(alias_list) > 1:
        raise CriticalDockyardException('There are multiple running dockyards and no default set.'
                                        'Please specify dockyard by -d/--dockyard or set the default.')
    return alias_list[0]['name']