def remove_package(package_id): try: actions.remove_package( current_app.install, current_app.repository, package_id) except PackageNotFound: response = ( package_not_found_response(package_id), http.client.NOT_FOUND, ) except PackageConflict: response = ( error_response('Package {} is active, so it can\'t be removed.'), http.client.CONFLICT, ) except ValidationError: response = ( invalid_package_id_response(package_id), http.client.NOT_FOUND, ) else: response = empty_response return response
def main(): arguments = docopt( __doc__.format( default_config_dir=constants.config_dir, default_root=constants.install_root, default_repository=constants.repository_base, ), ) umask(0o022) # NOTE: Changing root or repository will likely break actually running packages. install = Install( os.path.abspath(arguments['--root']), os.path.abspath(arguments['--config-dir']), arguments['--rooted-systemd'], not arguments['--no-systemd'], not arguments['--no-block-systemd'], manage_users=True, add_users=not os.path.exists('/etc/mesosphere/manual_host_users'), manage_state_dir=True) repository = Repository(os.path.abspath(arguments['--repository'])) try: if arguments['setup']: actions.setup(install, repository) sys.exit(0) if arguments['list']: print_repo_list(repository.list()) sys.exit(0) if arguments['active']: for pkg in sorted(install.get_active()): print(pkg) sys.exit(0) if arguments['add']: actions.add_package_file(repository, arguments['<package-tarball>']) sys.exit(0) if arguments['fetch']: for package_id in arguments['<id>']: actions.fetch_package(repository, arguments['--repository-url'], package_id, os.getcwd()) sys.exit(0) if arguments['activate']: actions.activate_packages(install, repository, arguments['<id>'], not arguments['--no-systemd'], not arguments['--no-block-systemd']) sys.exit(0) if arguments['swap']: actions.swap_active_package(install, repository, arguments['<package-id>'], not arguments['--no-systemd'], not arguments['--no-block-systemd']) sys.exit(0) if arguments['remove']: for package_id in arguments['<id>']: try: actions.remove_package(install, repository, package_id) except PackageNotFound: pass sys.exit(0) if arguments['uninstall']: uninstall(install, repository) sys.exit(0) if arguments['check']: checks = find_checks(install, repository) if arguments['--list']: list_checks(checks) sys.exit(0) # Run all checks sys.exit(run_checks(checks, install, repository)) except ValidationError as ex: print("Validation Error: {0}".format(ex), file=sys.stderr) sys.exit(1) except PackageError as ex: print("Package Error: {0}".format(ex), file=sys.stderr) sys.exit(1) except Exception as ex: print("ERROR: {0}".format(ex), file=sys.stderr) sys.exit(1) print("unknown command", file=sys.stderr) sys.exit(1)
def main(): arguments = docopt(__doc__, version="Pkpganda Package Manager") umask(0o022) # NOTE: Changing root or repository will likely break actually running packages. install = Install( os.path.abspath(arguments['--root']), os.path.abspath(arguments['--config-dir']), arguments['--rooted-systemd'], not arguments['--no-systemd'], not arguments['--no-block-systemd']) repository = Repository(os.path.abspath(arguments['--repository'])) try: if arguments['setup']: actions.setup(install, repository) sys.exit(0) if arguments['list']: print_repo_list(repository.list()) sys.exit(0) if arguments['active']: for pkg in sorted(install.get_active()): print(pkg) sys.exit(0) if arguments['add']: actions.add_package_file(repository, arguments['<package-tarball>']) sys.exit(0) if arguments['fetch']: for package_id in arguments['<id>']: actions.fetch_package( repository, arguments['--repository-url'], package_id, os.getcwd()) sys.exit(0) if arguments['activate']: actions.activate_packages( install, repository, arguments['<id>'], not arguments['--no-systemd'], not arguments['--no-block-systemd']) sys.exit(0) if arguments['swap']: actions.swap_active_package( install, repository, arguments['<package-id>'], not arguments['--no-systemd'], not arguments['--no-block-systemd']) sys.exit(0) if arguments['remove']: for package_id in arguments['<id>']: actions.remove_package(install, repository, package_id) sys.exit(0) if arguments['uninstall']: uninstall(install, repository) sys.exit(0) if arguments['check']: checks = find_checks(install, repository) if arguments['--list']: list_checks(checks) sys.exit(0) # Run all checks sys.exit(run_checks(checks, install, repository)) except Exception as ex: print("ERROR: {0}".format(ex)) sys.exit(1) except ValidationError as ex: print("Validation Error: {0}".format(ex)) sys.exit(1) except PackageError as ex: print("Package Error: {0}".format(ex)) sys.exit(1) print("unknown command") sys.exit(1)
def main(): arguments = docopt(__doc__, version="Pkpganda Package Manager") umask(0o022) # NOTE: Changing root or repository will likely break actually running packages. install = Install(os.path.abspath(arguments['--root']), os.path.abspath(arguments['--config-dir']), arguments['--rooted-systemd'], not arguments['--no-systemd'], not arguments['--no-block-systemd']) repository = Repository(os.path.abspath(arguments['--repository'])) try: if arguments['setup']: actions.setup(install, repository) sys.exit(0) if arguments['list']: print_repo_list(repository.list()) sys.exit(0) if arguments['active']: for pkg in sorted(install.get_active()): print(pkg) sys.exit(0) if arguments['add']: actions.add_package_file(repository, arguments['<package-tarball>']) sys.exit(0) if arguments['fetch']: for package_id in arguments['<id>']: actions.fetch_package(repository, arguments['--repository-url'], package_id, os.getcwd()) sys.exit(0) if arguments['activate']: actions.activate_packages(install, repository, arguments['<id>'], not arguments['--no-systemd'], not arguments['--no-block-systemd']) sys.exit(0) if arguments['swap']: actions.swap_active_package(install, repository, arguments['<package-id>'], not arguments['--no-systemd'], not arguments['--no-block-systemd']) sys.exit(0) if arguments['remove']: for package_id in arguments['<id>']: actions.remove_package(install, repository, package_id) sys.exit(0) if arguments['uninstall']: uninstall(install, repository) sys.exit(0) if arguments['check']: checks = find_checks(install, repository) if arguments['--list']: list_checks(checks) sys.exit(0) # Run all checks sys.exit(run_checks(checks, install, repository)) except Exception as ex: print("ERROR: {0}".format(ex)) sys.exit(1) except ValidationError as ex: print("Validation Error: {0}".format(ex)) sys.exit(1) except PackageError as ex: print("Package Error: {0}".format(ex)) sys.exit(1) print("unknown command") sys.exit(1)
def main(): arguments = docopt( __doc__.format( default_config_dir=constants.config_dir, default_root=constants.install_root, default_repository=constants.repository_base, ), ) umask(0o022) # NOTE: Changing root or repository will likely break actually running packages. install = Install( os.path.abspath(arguments['--root']), os.path.abspath(arguments['--config-dir']), arguments['--rooted-systemd'], not arguments['--no-systemd'], not arguments['--no-block-systemd'], manage_users=True, add_users=not os.path.exists('/etc/mesosphere/manual_host_users'), manage_state_dir=True) repository = Repository(os.path.abspath(arguments['--repository'])) try: if arguments['setup']: actions.setup(install, repository) sys.exit(0) if arguments['list']: print_repo_list(repository.list()) sys.exit(0) if arguments['active']: for pkg in sorted(install.get_active()): print(pkg) sys.exit(0) if arguments['add']: actions.add_package_file(repository, arguments['<package-tarball>']) sys.exit(0) if arguments['fetch']: for package_id in arguments['<id>']: actions.fetch_package( repository, arguments['--repository-url'], package_id, os.getcwd()) sys.exit(0) if arguments['activate']: actions.activate_packages( install, repository, arguments['<id>'], not arguments['--no-systemd'], not arguments['--no-block-systemd']) sys.exit(0) if arguments['swap']: actions.swap_active_package( install, repository, arguments['<package-id>'], not arguments['--no-systemd'], not arguments['--no-block-systemd']) sys.exit(0) if arguments['remove']: for package_id in arguments['<id>']: try: actions.remove_package(install, repository, package_id) except PackageNotFound: pass sys.exit(0) if arguments['uninstall']: uninstall(install, repository) sys.exit(0) if arguments['check']: checks = find_checks(install, repository) if arguments['--list']: list_checks(checks) sys.exit(0) # Run all checks sys.exit(run_checks(checks, install, repository)) except ValidationError as ex: print("Validation Error: {0}".format(ex)) sys.exit(1) except PackageError as ex: print("Package Error: {0}".format(ex)) sys.exit(1) except Exception as ex: print("ERROR: {0}".format(ex)) sys.exit(1) print("unknown command") sys.exit(1)