Merge pull request #118 from mesosphere/dcos-805-suggest-update
dcos-805 UX improvements
This commit is contained in:
@@ -48,8 +48,8 @@ import os
|
||||
import dcoscli
|
||||
import docopt
|
||||
import pkg_resources
|
||||
from dcos.api import (cmds, config, constants, emitting, marathon, options,
|
||||
package, util)
|
||||
from dcos.api import (cmds, config, constants, emitting, errors, marathon,
|
||||
options, package, util)
|
||||
|
||||
emitter = emitting.FlatEmitter()
|
||||
|
||||
@@ -177,10 +177,10 @@ def _list_sources():
|
||||
|
||||
config = _load_config()
|
||||
|
||||
sources, errors = package.list_sources(config)
|
||||
sources, errs = package.list_sources(config)
|
||||
|
||||
if len(errors) > 0:
|
||||
for err in errors:
|
||||
if len(errs) > 0:
|
||||
for err in errs:
|
||||
emitter.publish(err)
|
||||
return 1
|
||||
|
||||
@@ -199,10 +199,10 @@ def _update():
|
||||
|
||||
config = _load_config()
|
||||
|
||||
errors = package.update_sources(config)
|
||||
errs = package.update_sources(config)
|
||||
|
||||
if len(errors) > 0:
|
||||
for err in errors:
|
||||
if len(errs) > 0:
|
||||
for err in errs:
|
||||
emitter.publish(err)
|
||||
return 1
|
||||
|
||||
@@ -278,9 +278,14 @@ def _install(package_name, options_file, app_id, cli, app):
|
||||
config = _load_config()
|
||||
|
||||
pkg = package.resolve_package(package_name, config)
|
||||
|
||||
if pkg is None:
|
||||
emitter.publish("Package [{}] not found".format(package_name))
|
||||
emitter.publish(
|
||||
errors.DefaultError(
|
||||
"Package [{}] not found".format(package_name)))
|
||||
emitter.publish(
|
||||
errors.DefaultError(
|
||||
"You may need to run 'dcos package update' to update your "
|
||||
"repositories"))
|
||||
return 1
|
||||
|
||||
options_json = {}
|
||||
|
||||
@@ -223,6 +223,17 @@ with app id [dns-2]\n"""
|
||||
assert stderr == b''
|
||||
|
||||
|
||||
def test_install_missing_package():
|
||||
returncode, stdout, stderr = exec_command(
|
||||
['dcos', 'package', 'install', 'missing-package'])
|
||||
|
||||
assert returncode == 1
|
||||
assert stdout == b''
|
||||
assert stderr == b"""Package [missing-package] not found
|
||||
You may need to run 'dcos package update' to update your repositories
|
||||
"""
|
||||
|
||||
|
||||
def test_uninstall_with_id():
|
||||
returncode, stdout, stderr = exec_command(
|
||||
['dcos', 'package', 'uninstall', 'mesos-dns', '--app-id=dns-1'])
|
||||
|
||||
Reference in New Issue
Block a user