def _get_package_manager(): """ Get an instance of Cosmos with the correct URL. :return: Cosmos instance :rtype: packagemanager.PackageManager """ return packagemanager.PackageManager(cosmos.get_cosmos_url())
def uninstall(service, package=PACKAGE_NAME): try: task = get_service_task(package, service) if task is not None: cosmos_pm = packagemanager.PackageManager(cosmos.get_cosmos_url()) cosmos_pm.uninstall_app(package, True, service) common.deployment_wait() assert common.wait_for_service_endpoint_removal('test-marathon') delete_zk_node('/universe/{}'.format(service)) except Exception: pass
def _check_capability(): """ The function checks if cluster has metronome capability. :raises: DCOSException if cluster does not have metronome capability """ manager = packagemanager.PackageManager(cosmos.get_cosmos_url()) if not manager.has_capability('METRONOME'): raise DCOSException( 'DC/OS backend does not support metronome capabilities in this ' 'version. Must be DC/OS >= 1.8')
def test_custom_service_name(): """ Install MoM with a custom service name. """ cosmos_pm = packagemanager.PackageManager(cosmos.get_cosmos_url()) cosmos_pm.get_package_version('marathon', None) options = {'service': {'name': "test-marathon"}} install_package('marathon', options_json=options) deployment_wait(service_id=options["service"]["name"], max_attempts=300) shakedown.dcos.service.wait_for_service_endpoint('test-marathon', timeout_sec=300, path="ping")
def get_package_manager(): """Returns type of package manager to use :returns: PackageManager instance :rtype: packagemanager.PackageManager """ cosmos_url = cosmos.get_cosmos_url() cosmos_manager = packagemanager.PackageManager(cosmos_url) if cosmos_manager.enabled(): return cosmos_manager else: msg = ("This version of the DC/OS CLI is not supported for your " "cluster. Please downgrade the CLI to an older version: " "https://dcos.io/docs/usage/cli/update/#downgrade") raise DCOSException(msg)