def test_pull(self): with patch_all(): with self.source_context() as source: with self.target_context() as target: self.upload_dummy_package(target) sleep(1) source.remote_servers = [RemoteConfiguration(dict(address='127.0.0.1', http_port=target.webserver.port, ftp_port=target.ftpserver.port))] sync.pull_packages(source, 'main-stable', '127.0.0.1', 'main-stable', 'my-app') sleep(1) self.assert_package_exists(source, "my-app")
def test_pull(self): with patch_all(): with self.source_context() as source: with self.target_context() as target: self.upload_dummy_package(target) sleep(1) source.remote_servers = [ RemoteConfiguration( dict(address='127.0.0.1', http_port=target.webserver.port, ftp_port=target.ftpserver.port)) ] sync.pull_packages(source, 'main-stable', '127.0.0.1', 'main-stable', 'my-app') sleep(1) self.assert_package_exists(source, "my-app")
def app_repo(argv=argv[1:]): extended.bypass_console_script_logging() args = extended.docopt(__doc__, argv) config = extended.get_config(args) if args['package'] and args['list']: return extended.show_packages(config, args['--index']) elif args['package'] and args['remote-list']: return extended.show_remote_packages(config, args['--remote-server'], args['--remote-index']) elif args['package'] and args['pull']: from infi.app_repo.sync import pull_packages return pull_packages(config, args['--index'], args['--remote-server'], args['--remote-index'], args['<package>'], args['<version>'] or 'latest', args['<platform>'], args['<arch>'])
def eapp_repo(argv=argv[1:]): from infi.logging.wrappers import script_logging_context bypass_console_script_logging() args = docopt(__doc__, argv) config = get_config(args) if args['counters'] and args['show']: return show_counters(config) elif args['config'] and args['show']: print config.to_json() elif args['config'] and args['reset']: config.reset_to_development_defaults() if args['--development'] else config.reset_to_production_defaults() elif args['setup']: if args['--development']: config.reset_to_development_defaults() if args['--with-legacy']: config.webserver.support_legacy_uris = True config.to_disk() return setup(config, args['--with-mock'], args['--force-resignature']) elif args['destroy']: if args['--yes']: from infi.app_repo.install import destroy_all destroy_all(config) else: print "This command will destroy the application repository" print "If this is absolutely what you want, pass the --yes flag in the command-line.\nAborting." elif args['web-server']: return web_server(config, args['--signal-upstart']) elif args['ftp-server']: return ftp_server(config, args['--signal-upstart']) elif args['rpc-server']: return rpc_server(config, args['--signal-upstart'], args['--with-mock']) elif args['rpc-client']: return rpc_client(config, args['<method>'], args['<arg>'], args['--style'], args['--async']) elif args['service'] and args['upload-file']: return upload_file(config, args['--index'], args['<filepath>']) elif args['service'] and args['process-rejected-file']: return process_rejected_file(config, args['--index'], args['<filepath>'], args['<platform>'], args['<arch>'], args['--async']) elif args['service'] and args['process-incoming']: return process_incoming(config, args['<index>'], args['--async']) elif args['service'] and args['rebuild-index']: return rebuild_index(config, args['<index>'], args['<index-type>'], args['--async']) elif args['service'] and args['resign-packages']: return resign_packages(config, args['--async']) elif args['index'] and args['list']: print ' '.join(config.indexes) elif args['index'] and args['add']: return add_index(config, args['<index>'], args['--async']) elif args['index'] and args['remove']: if args['--yes']: return remove_index(config, args['<index>'], args['--async']) else: print "This command will remove index \"{0}\" from the application repository".format(args['<index>']) print "If this is absolutely what you want, pass the --yes flag in the command-line.\nAborting." elif args['package'] and args['list']: return show_packages(config, args['--index']) elif args['package'] and args['remote-list']: return show_remote_packages(config, args['<remote-server>'], args['<remote-index>']) elif args['package'] and args['pull']: from infi.app_repo.sync import pull_packages pull_packages = console_script(name="app_repo_pull")(pull_packages) return pull_packages(config, args['--index'], args['<remote-server>'], args['<remote-index>'], args['<package>'], args['<version>'], args['<platform>'], args['<arch>']) elif args['package'] and args['push']: from infi.app_repo.sync import push_packages push_packages = console_script(name="app_repo_push")(push_packages) return push_packages(config, args['--index'], args['<remote-server>'], args['<remote-index>'], args.get('<package>'), args.get('<version>'), args.get('<platform>'), args.get('<arch>')) elif args['package'] and args['delete']: with script_logging_context(syslog=False, logfile=False, stderr=True): return delete_packages(config, build_regex_predicate(args['<regex>']), args['<index>'], args['<index-type>'], args['--dry-run'], args['--yes'], args['--no-rebuild'], args['--async']) elif args['package'] and args['cleanup']: return delete_old_packages(config, args['<index>'], args['--dry-run'], args['--yes'], int(args['--days']))
def eapp_repo(argv=argv[1:]): bypass_console_script_logging() args = docopt(__doc__, argv) config = get_config(args) if args['counters'] and args['show']: return show_counters(config) elif args['config'] and args['show']: print config.to_json() elif args['config'] and args['apply']: config.reset_to_development_defaults() if args['development-defaults'] else None config.reset_to_production_defaults() if args['production-defaults'] else None elif args['setup']: config.reset_to_development_defaults() if args['development-defaults'] else None config.reset_to_production_defaults() if args['production-defaults'] else None if args['--with-legacy']: config.webserver.support_legacy_uris = True config.to_disk() return setup(config, args['--with-mock'], args['--force-resignature']) elif args['destroy'] and args['--yes']: from infi.app_repo.install import destroy_all destroy_all(config) elif args['web-server']: return web_server(config, args['--signal-upstart']) elif args['ftp-server']: return ftp_server(config, args['--signal-upstart']) elif args['rpc-server']: return rpc_server(config, args['--signal-upstart'], args['--with-mock']) elif args['rpc-client']: return rpc_client(config, args['<method>'], args['<arg>'], args['--style'], args['--async']) elif args['service'] and args['upload-file']: return upload_file(config, args['--index'], args['<filepath>']) elif args['service'] and args['process-rejected-file']: return process_rejected_file(config, args['--index'], args['<filepath>'], args['<platform>'], args['<arch>'], args['--async']) elif args['service'] and args['process-incoming']: return process_incoming(config, args['<index>'], args['--async']) elif args['service'] and args['rebuild-index']: return rebuild_index(config, args['<index>'], args['<index-type>'], args['--async']) elif args['service'] and args['resign-packages']: return resign_packages(config, args['--async']) elif args['index'] and args['list']: print ' '.join(config.indexes) elif args['index'] and args['add']: return add_index(config, args['<index>'], args['--async']) elif args['index'] and args['remove'] and args['--yes']: return remove_index(config, args['<index>'], args['--async']) elif args['package'] and args['list']: return show_packages(config, args['--index']) elif args['package'] and args['remote-list']: return show_remote_packages(config, args['<remote-server>'], args['<remote-index>']) elif args['package'] and args['pull']: from infi.app_repo.sync import pull_packages pull_packages = console_script(name="app_repo_pull")(pull_packages) return pull_packages(config, args['--index'], args['<remote-server>'], args['<remote-index>'], args['<package>'], args['<version>'], args['<platform>'], args['<arch>']) elif args['package'] and args['push']: from infi.app_repo.sync import push_packages push_packages = console_script(name="app_repo_push")(push_packages) return push_packages(config, args['--index'], args['<remote-server>'], args['<remote-index>'], args.get('<package>'), args.get('<version>'), args.get('<platform>'), args.get('<arch>')) elif args['package'] and args['delete']: return delete_packages(config, build_regex_predicate(args['<regex>']), args['<index>'], args['<index-type>'], args['--dry-run'], args['--yes']) elif args['package'] and args['cleanup']: return delete_old_packages(config, args['<index>'], args['--dry-run'], args['--yes'])
def eapp_repo(argv=argv[1:]): from infi.logging.wrappers import script_logging_context bypass_console_script_logging() args = docopt(__doc__, argv) config = get_config(args) if args['counters'] and args['show']: return show_counters(config) elif args['config'] and args['show']: print(config.to_json()) elif args['config'] and args['reset']: config.reset_to_development_defaults() if args['--development'] else config.reset_to_production_defaults() elif args['setup']: if args['--development']: config.reset_to_development_defaults() if args['--with-legacy']: config.webserver.support_legacy_uris = True config.to_disk() return setup(config, args['--with-mock'], args['--force-resignature']) elif args['destroy']: if args['--yes']: from infi.app_repo.install import destroy_all destroy_all(config) else: print("This command will destroy the application repository") print("If this is absolutely what you want, pass the --yes flag in the command-line.\nAborting.") elif args['web-server']: return web_server(config) elif args['ftp-server']: return ftp_server(config) elif args['rpc-server']: return rpc_server(config, args['--with-mock']) elif args['rpc-client']: return rpc_client(config, args['<method>'], args['<arg>'], args['--style'], args['--async']) elif args['service'] and args['upload-file']: return upload_file(config, args['--index'], args['<filepath>']) elif args['service'] and args['process-rejected-file']: return process_rejected_file(config, args['--index'], args['<filepath>'], args['<platform>'], args['<arch>'], args['--async']) elif args['service'] and args['process-incoming']: return process_incoming(config, args['<index>'], args['--async']) elif args['service'] and args['rebuild-index']: return rebuild_index(config, args['<index>'], args['<index-type>'], args['--async']) elif args['service'] and args['resign-packages']: return resign_packages(config, args['--async']) elif args['index'] and args['list']: print(' '.join(config.indexes)) elif args['index'] and args['add']: return add_index(config, args['<index>'], args['--async']) elif args['index'] and args['remove']: if args['--yes']: return remove_index(config, args['<index>'], args['--async']) else: print(("This command will remove index \"{0}\" from the application repository".format(args['<index>']))) print("If this is absolutely what you want, pass the --yes flag in the command-line.\nAborting.") elif args['package'] and args['list']: return show_packages(config, args['--index']) elif args['package'] and args['remote-list']: return show_remote_packages(config, args['<remote-server>'], args['<remote-index>']) elif args['package'] and args['pull']: from infi.app_repo.sync import pull_packages pull_packages = console_script(name="app_repo_pull")(pull_packages) return pull_packages(config, args['--index'], args['<remote-server>'], args['<remote-index>'], args['<package>'], args['<version>'], args['<platform>'], args['<arch>']) elif args['package'] and args['push']: from infi.app_repo.sync import push_packages push_packages = console_script(name="app_repo_push")(push_packages) return push_packages(config, args['--index'], args['<remote-server>'], args['<remote-index>'], args.get('<package>'), args.get('<version>'), args.get('<platform>'), args.get('<arch>')) elif args['package'] and args['delete']: with script_logging_context(syslog=False, logfile=False, stderr=True): return delete_packages(config, build_regex_predicate(args['<regex>']), args['<index>'], args['<index-type>'], args['--dry-run'], args['--yes'], args['--no-rebuild'], args['--async']) elif args['package'] and args['cleanup']: with script_logging_context(syslog=False, logfile=False, stderr=True): return delete_old_packages(config, args['<index>'], args['--dry-run'], args['--yes'], int(args['--days']))
def eapp_repo(argv=argv[1:]): bypass_console_script_logging() args = docopt(__doc__, argv) config = get_config(args) if args['counters'] and args['show']: return show_counters(config) elif args['config'] and args['show']: print config.to_json() elif args['config'] and args['apply']: config.reset_to_development_defaults( ) if args['development-defaults'] else None config.reset_to_production_defaults( ) if args['production-defaults'] else None elif args['setup']: config.reset_to_development_defaults( ) if args['development-defaults'] else None config.reset_to_production_defaults( ) if args['production-defaults'] else None if args['--with-legacy']: config.webserver.support_legacy_uris = True config.to_disk() return setup(config, args['--with-mock'], args['--force-resignature']) elif args['destroy'] and args['--yes']: from infi.app_repo.install import destroy_all destroy_all(config) elif args['web-server']: return web_server(config, args['--signal-upstart']) elif args['ftp-server']: return ftp_server(config, args['--signal-upstart']) elif args['rpc-server']: return rpc_server(config, args['--signal-upstart'], args['--with-mock']) elif args['rpc-client']: return rpc_client(config, args['<method>'], args['<arg>'], args['--style'], args['--async']) elif args['service'] and args['upload-file']: return upload_file(config, args['--index'], args['<filepath>']) elif args['service'] and args['process-rejected-file']: return process_rejected_file(config, args['--index'], args['<filepath>'], args['<platform>'], args['<arch>'], args['--async']) elif args['service'] and args['process-incoming']: return process_incoming(config, args['<index>'], args['--async']) elif args['service'] and args['rebuild-index']: return rebuild_index(config, args['<index>'], args['<index-type>'], args['--async']) elif args['service'] and args['resign-packages']: return resign_packages(config, args['--async']) elif args['index'] and args['list']: print ' '.join(config.indexes) elif args['index'] and args['add']: return add_index(config, args['<index>'], args['--async']) elif args['index'] and args['remove'] and args['--yes']: return remove_index(config, args['<index>'], args['--async']) elif args['package'] and args['list']: return show_packages(config, args['--index']) elif args['package'] and args['remote-list']: return show_remote_packages(config, args['<remote-server>'], args['<remote-index>']) elif args['package'] and args['pull']: from infi.app_repo.sync import pull_packages pull_packages = console_script(name="app_repo_pull")(pull_packages) return pull_packages(config, args['--index'], args['<remote-server>'], args['<remote-index>'], args['<package>'], args['<version>'], args['<platform>'], args['<arch>']) elif args['package'] and args['push']: from infi.app_repo.sync import push_packages push_packages = console_script(name="app_repo_push")(push_packages) return push_packages(config, args['--index'], args['<remote-server>'], args['<remote-index>'], args.get('<package>'), args.get('<version>'), args.get('<platform>'), args.get('<arch>')) elif args['package'] and args['delete']: return delete_packages(config, build_regex_predicate(args['<regex>']), args['<index>'], args['<index-type>'], args['--dry-run'], args['--yes']) elif args['package'] and args['cleanup']: return delete_old_packages(config, args['<index>'], args['--dry-run'], args['--yes'])