예제 #1
0
def init():  # pragma: no cover
    if not os.path.exists(os.path.join(settings.CONFIG_DATA_FOLDER,
                          settings.CONFIG_FILE_USER)):
        config = Config()
        config = initial_setup(config)
        log.info('Creating pyu-data dir...')
        pyu = PyUpdater(config)
        pyu.setup()
        loader = Loader()
        loader.save_config(config)
        log.info('Setup complete')
    else:
        sys.exit('Not an empty PyUpdater repository')
예제 #2
0
파일: __init__.py 프로젝트: vvarp/PyUpdater
def init():  # pragma: no cover
    if not os.path.exists(os.path.join(settings.CONFIG_DATA_FOLDER,
                          settings.CONFIG_FILE_USER)):
        config = Config()
        config = initial_setup(config)
        log.info('Creating pyu-data dir...')
        pyu = PyUpdater(config)
        pyu.setup()
        loader = Loader()
        loader.save_config(config)
        log.info('Setup complete')
    else:
        sys.exit('Not an empty PyUpdater repository')
예제 #3
0
def init(args):  # pragma: no cover
    db = Storage()
    loader = Loader(db)
    count = args.count
    if count > 10:
        sys.exit('Cannot be more then 10')
    if not os.path.exists(os.path.join(settings.CONFIG_DATA_FOLDER,
                          settings.CONFIG_FILE_USER)):
        config = initial_setup(SetupConfig())
        log.info('Creating pyu-data dir...')
        pyu = PyUpdater(config, db)
        pyu.setup()
        log.info('Making signing keys...')
        pyu.make_keys(count)
        config.PUBLIC_KEYS = pyu.get_public_keys()
        loader.save_config(config)
        log.info('Setup complete')
        db._sync_db()
    else:
        sys.exit('Not an empty PyUpdater repository')
예제 #4
0
def init(args):  # pragma: no cover
    db = Storage()
    loader = Loader(db)
    count = args.count
    if count > 10:
        sys.exit('Cannot be more then 10')
    if not os.path.exists(
            os.path.join(settings.CONFIG_DATA_FOLDER,
                         settings.CONFIG_FILE_USER)):
        config = initial_setup(SetupConfig())
        log.info('Creating pyu-data dir...')
        pyu = PyUpdater(config, db)
        pyu.setup()
        log.info('Making signing keys...')
        pyu.make_keys(count)
        config.PUBLIC_KEYS = pyu.get_public_keys()
        loader.save_config(config)
        log.info('Setup complete')
        db._sync_db()
    else:
        sys.exit('Not an empty PyUpdater repository')
예제 #5
0
def _cmd_init(*args):  # pragma: no cover
    if not os.path.exists(
            os.path.join(settings.CONFIG_DATA_FOLDER,
                         settings.CONFIG_FILE_USER)):
        # Load a basic config.
        config = Config()

        # Run config through all of the setup functions
        config = initial_setup(config)
        log.info('Creating pyu-data dir...')

        # Initialize PyUpdater with newly created config
        pyu = PyUpdater(config)

        # Setup repository
        pyu.setup()

        # Load config manager & save config to disk
        cm = ConfigManager()
        cm.save_config(config)
        log.info('Setup complete')
    else:
        log.error('Not an empty PyUpdater repository')