コード例 #1
0
def _show_couchdb_database_dir_content():
    database_dir = couchdb.get_database_dir()
    print '===== couchdb database list'
    for filename in database_dir:
        db_directory = database_dir[filename]
        print '=== {}'.format(db_directory)
        print helpers.cmd_exec('ls -l {}'.format(db_directory))['stdout']
コード例 #2
0
ファイル: diag.py プロジェクト: nono/python_cozy_management
def _show_couchdb_database_dir_content():
    database_dir = couchdb.get_database_dir()
    print '===== couchdb database list'
    for filename in database_dir:
        db_directory = database_dir[filename]
        print '=== {}'.format(db_directory)
        print helpers.cmd_exec('ls -l {}'.format(db_directory))['stdout']
コード例 #3
0
def exec_and_print(command_line, text=None):
    if text is None:
        text = command_line
    result = helpers.cmd_exec(command_line)
    print '===== {}'.format(text)
    print _clean_result(result['stderr'])
    print _clean_result(result['stdout'])
コード例 #4
0
ファイル: diag.py プロジェクト: nono/python_cozy_management
def exec_and_print(command_line, text=None):
    if text is None:
        text = command_line
    result = helpers.cmd_exec(command_line)
    print '===== {}'.format(text)
    print _clean_result(result['stderr'])
    print _clean_result(result['stdout'])
コード例 #5
0
def check_lsb_codename():
    codename = helpers.cmd_exec('lsb_release -cs')['stdout'].rstrip('\n')
    if codename not in ['jessie', 'trusty']:
        print '[KO] you need to install Cozy on Debian jessie or Ubuntu trusty'
        print '!!!! If you continue, we can\'t support your installation.'
        return -1
    else:
        return 0
コード例 #6
0
def update():
    print 'Updating weboob configuration'
    result = cmd_exec('weboob-config update')
    if (result['error']):
        print result['stderr']
        print 'Update failed'
    else:
        print 'Update succeeded'
コード例 #7
0
ファイル: diag.py プロジェクト: nono/python_cozy_management
def check_lsb_codename():
    codename = helpers.cmd_exec('lsb_release -cs')['stdout'].rstrip('\n')
    if codename not in ['jessie', 'trusty']:
        print '[KO] you need to install Cozy on Debian jessie or Ubuntu trusty'
        print '!!!! If you continue, we can\'t support your installation.'
        return -1
    else:
        return 0
コード例 #8
0
ファイル: weboob.py プロジェクト: cozy/python_cozy_management
def update():
    print 'Updating weboob configuration'
    result = cmd_exec('weboob-config update')
    if (result['error']):
        print result['stderr']
        print 'Update failed'
    else:
        print 'Update succeeded'
コード例 #9
0
def install():
    '''
        Install weboob system-wide
    '''
    tmp_weboob_dir = '/tmp/weboob'

    # Check that the directory does not already exists
    while (os.path.exists(tmp_weboob_dir)):
        tmp_weboob_dir += '1'

    # Clone the repository
    print 'Fetching sources in temporary dir {}'.format(tmp_weboob_dir)
    result = cmd_exec('git clone {} {}'.format(WEBOOB_REPO, tmp_weboob_dir))
    if (result['error']):
        print result['stderr']
        print 'Weboob installation failed: could not clone repository'
        exit()

    print 'Sources fetched, will now process to installation'

    # Launch the installation
    result = cmd_exec('cd {} && ./setup.py install'.format(tmp_weboob_dir))

    # Remove the weboob directory
    shutil.rmtree(tmp_weboob_dir)

    if (result['error']):
        print result['stderr']
        print 'Weboob installation failed: setup failed'
        exit()

    print result['stdout']

    # Check weboob version
    weboob_version = get_weboob_version()
    if (not weboob_version):
        print 'Weboob installation failed: version not detected'
        exit()

    print 'Weboob (version: {}) installation succeeded'.format(weboob_version)
    update()
コード例 #10
0
ファイル: weboob.py プロジェクト: cozy/python_cozy_management
def install():
    '''
        Install weboob system-wide
    '''
    tmp_weboob_dir = '/tmp/weboob'

    # Check that the directory does not already exists
    while (os.path.exists(tmp_weboob_dir)):
        tmp_weboob_dir += '1'

    # Clone the repository
    print 'Fetching sources in temporary dir {}'.format(tmp_weboob_dir)
    result = cmd_exec('git clone {} {}'.format(WEBOOB_REPO, tmp_weboob_dir))
    if (result['error']):
        print result['stderr']
        print 'Weboob installation failed: could not clone repository'
        exit()

    print 'Sources fetched, will now process to installation'

    # Launch the installation
    result = cmd_exec('cd {} && ./setup.py install'.format(tmp_weboob_dir))

    # Remove the weboob directory
    shutil.rmtree(tmp_weboob_dir)

    if (result['error']):
        print result['stderr']
        print 'Weboob installation failed: setup failed'
        exit()

    print result['stdout']

    # Check weboob version
    weboob_version = get_weboob_version()
    if (not weboob_version):
        print 'Weboob installation failed: version not detected'
        exit()

    print 'Weboob (version: {}) installation succeeded'.format(weboob_version)
    update()
コード例 #11
0
def get_weboob_version():
    result = cmd_exec('weboob-cli --version')
    if (not result['error']):
        return result['stdout'].rstrip()

    return None
コード例 #12
0
ファイル: weboob.py プロジェクト: cozy/python_cozy_management
def get_weboob_version():
    result = cmd_exec('weboob-cli --version')
    if (not result['error']):
        return result['stdout'].rstrip()

    return None