Rename node --slave -> node --mesos-id

This commit is contained in:
Branden Rolston
2016-03-22 12:13:33 -07:00
parent 64ccfa777e
commit faf559fac3
4 changed files with 30 additions and 14 deletions

View File

@@ -3,12 +3,12 @@ Manage DCOS nodes
Usage:
dcos node --info
dcos node [--json]
dcos node log [--follow --lines=N --leader --master --slave=<slave-id>]
dcos node log [--follow --lines=N --leader --master --mesos-id=<mesos-id> --slave=<slave-id>]
dcos node ssh [--option SSHOPT=VAL ...]
[--config-file=<path>]
[--user=<user>]
[--master-proxy]
(--leader | --master | --slave=<slave-id>)
(--leader | --master | --mesos-id=<mesos-id> | --slave=<slave-id>)
Options:
-h, --help Show this screen
@@ -23,7 +23,8 @@ Options:
configuration, the private slaves are unreachable from the public
internet. You can access them using this option, which will first hop
from the publicly available master.
--slave=<slave-id> Access the slave with the provided ID
--slave=<slave-id> Deprecated. Please use --mesos-id.
--mesos-id=<mesos-id> Access the node with the provided Mesos ID
--option SSHOPT=VAL SSH option (see `man ssh_config`)
--config-file=<path> Path to SSH config file
--user=<user> SSH user [default: core]

View File

@@ -33,6 +33,10 @@ def _main():
raise DCOSException(
'--master has been deprecated. Please use --leader.'
)
elif args.get('--slave'):
raise DCOSException(
'--slave has been deprecated. Please use --mesos-id.'
)
return cmds.execute(_cmds(), args)
@@ -60,12 +64,12 @@ def _cmds():
cmds.Command(
hierarchy=['node', 'log'],
arg_keys=['--follow', '--lines', '--leader', '--slave'],
arg_keys=['--follow', '--lines', '--leader', '--mesos-id'],
function=_log),
cmds.Command(
hierarchy=['node', 'ssh'],
arg_keys=['--leader', '--slave', '--option', '--config-file',
arg_keys=['--leader', '--mesos-id', '--option', '--config-file',
'--user', '--master-proxy'],
function=_ssh),
@@ -126,7 +130,7 @@ def _log(follow, lines, leader, slave):
"""
if not (leader or slave):
raise DCOSException('You must choose one of --leader or --slave.')
raise DCOSException('You must choose one of --leader or --mesos-id.')
lines = util.parse_int(lines)

View File

@@ -3,12 +3,12 @@ Manage DCOS nodes
Usage:
dcos node --info
dcos node [--json]
dcos node log [--follow --lines=N --leader --master --slave=<slave-id>]
dcos node log [--follow --lines=N --leader --master --mesos-id=<mesos-id> --slave=<slave-id>]
dcos node ssh [--option SSHOPT=VAL ...]
[--config-file=<path>]
[--user=<user>]
[--master-proxy]
(--leader | --master | --slave=<slave-id>)
(--leader | --master | --mesos-id=<mesos-id> | --slave=<slave-id>)
Options:
-h, --help Show this screen
@@ -23,7 +23,8 @@ Options:
configuration, the private slaves are unreachable from the public
internet. You can access them using this option, which will first hop
from the publicly available master.
--slave=<slave-id> Access the slave with the provided ID
--slave=<slave-id> Deprecated. Please use --mesos-id.
--mesos-id=<mesos-id> Access the node with the provided Mesos ID
--option SSHOPT=VAL SSH option (see `man ssh_config`)
--config-file=<path> Path to SSH config file
--user=<user> SSH user [default: core]

View File

@@ -43,7 +43,7 @@ def test_node_table():
def test_node_log_empty():
stderr = b"You must choose one of --leader or --slave.\n"
stderr = b"You must choose one of --leader or --mesos-id.\n"
assert_command(['dcos', 'node', 'log'], returncode=1, stderr=stderr)
@@ -53,12 +53,12 @@ def test_node_log_leader():
def test_node_log_slave():
slave_id = _node()[0]['id']
assert_lines(['dcos', 'node', 'log', '--slave={}'.format(slave_id)], 10)
assert_lines(['dcos', 'node', 'log', '--mesos-id={}'.format(slave_id)], 10)
def test_node_log_missing_slave():
returncode, stdout, stderr = exec_command(
['dcos', 'node', 'log', '--slave=bogus'])
['dcos', 'node', 'log', '--mesos-id=bogus'])
assert returncode == 1
assert stdout == b''
@@ -69,7 +69,7 @@ def test_node_log_leader_slave():
slave_id = _node()[0]['id']
returncode, stdout, stderr = exec_command(
['dcos', 'node', 'log', '--leader', '--slave={}'.format(slave_id)])
['dcos', 'node', 'log', '--leader', '--mesos-id={}'.format(slave_id)])
assert returncode == 0
assert stderr == b''
@@ -97,7 +97,7 @@ def test_node_ssh_leader():
def test_node_ssh_slave():
slave_id = mesos.DCOSClient().get_state_summary()['slaves'][0]['id']
_node_ssh(['--slave={}'.format(slave_id), '--master-proxy'])
_node_ssh(['--mesos-id={}'.format(slave_id), '--master-proxy'])
def test_node_ssh_option():
@@ -151,6 +151,16 @@ def test_master_arg_deprecation_notice():
returncode=1)
def test_slave_arg_deprecation_notice():
stderr = b"--slave has been deprecated. Please use --mesos-id.\n"
assert_command(['dcos', 'node', 'log', '--slave=bogus'],
stderr=stderr,
returncode=1)
assert_command(['dcos', 'node', 'ssh', '--slave=bogus'],
stderr=stderr,
returncode=1)
def _node_ssh_output(args):
cli_test_ssh_key_path = os.environ['CLI_TEST_SSH_KEY_PATH']