8000 show fault domain in node and task subcommand output by initcore0 · Pull Request #1068 · dcos/dcos-cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

show fault domain in node and task subcommand output #1068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 3, 2017

Conversation

initcore0
Copy link
Contributor

Add 2 new fields: REGION and ZONE to dcos node and dcos task output

DCOS-17719

screen shot 2017-09-27 at 3 25 34 pm

Copy link
Contributor
@bamarni bamarni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comment otherwise LGTM

dcos/util.py Outdated
:param state: mesos state json top level or a node item
:type state: dict
:returns: region and zone
:rtype: str | None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this returns a tuple and not a single value, should this be :rtype: (str | None, str | None)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

get_fault_domain takes a state json top level or an agent dict and returns
a fault domain attributes: region and zone.
add fields: REGION, ZONE
example:
$ dcos node
   HOSTNAME        IP                         ID                    TYPE               REGION      ZONE
  10.0.2.140   10.0.2.140  446f21c5-2124-4eee-995b-e637c013ba72-S3  agent            us-west-2  us-west-2b
  10.0.5.32    10.0.5.32   446f21c5-2124-4eee-995b-e637c013ba72-S1  agent            us-west-2  us-west-2b
master.mesos.  10.0.4.195    446f21c5-2124-4eee-995b-e637c013ba72   master (leader)  us-west-2  us-west-2b
master.mesos.  10.0.4.23                     N/A                    master              N/A        N/A
master.mesos.  10.0.4.51                     N/A                    master              N/A        N/A

in multi master environment only the leader master will have REGION and ZONE
displayed. In order to display other master nodes attributes the CLI needs to
know external IP address and this is currently not supported.
@initcore0
Copy link
Contributor Author

run all integration tests

bamarni
bamarni previously approved these changes Sep 28, 2017
@initcore0
Copy link
Contributor Author

run all integration tests

add REGION and ZONE fields

example:
$ dcos task
NAME  HOST        USER  STATE  ID                                        MESOS ID                                   REGION      ZONE
abc   10.0.2.140  root    R    abc.879dde24-a3ce-11e7-9d44-422fc62916d6  446f21c5-2124-4eee-995b-e637c013ba72-S3  us-west-2  us-west-2b

if fault domain script was not configured, triple dash will be displayed
example:
NAME  HOST        USER  STATE  ID                                        MESOS ID                                 REGION  ZONE
abc   10.0.2.140  root    R    abc.21b24103-a3ce-11e7-9d44-422fc62916d6  446f21c5-2124-4eee-995b-e637c013ba72-S2   ---    ---
@initcore0 initcore0 force-pushed the mnaboka/fault-domain branch from f6d67c0 to d848734 Compare October 3, 2017 00:12
@initcore0
Copy link
Contributor Author

run all integration tests

Copy link
Contributor
@klueska klueska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Do we want to add a unit test with the CLI that actually checks the zone / region though? Could be a follow-on PR (or just a JIRA for now).

Would be good to actually exercise the code path here: https://github.com/dcos/dcos-cli/pull/1068/files#diff-0a44a6b7c22f30dd6669ec6caaafa771R740

@initcore0 initcore0 merged commit 94e617d into dcos:master Oct 3, 2017
@initcore0 initcore0 deleted the mnaboka/fault-domain branch October 3, 2017 16:00
klueska pushed a commit that referenced this pull request Nov 2, 2017
* add fn get_fault_domain

get_fault_domain takes a state json top level or an agent dict and returns
a fault domain attributes: region and zone.

* update `dcos node` sub command output

add fields: REGION, ZONE
example:
$ dcos node
   HOSTNAME        IP                         ID                    TYPE               REGION      ZONE
  10.0.2.140   10.0.2.140  446f21c5-2124-4eee-995b-e637c013ba72-S3  agent            us-west-2  us-west-2b
  10.0.5.32    10.0.5.32   446f21c5-2124-4eee-995b-e637c013ba72-S1  agent            us-west-2  us-west-2b
master.mesos.  10.0.4.195    446f21c5-2124-4eee-995b-e637c013ba72   master (leader)  us-west-2  us-west-2b
master.mesos.  10.0.4.23                     N/A                    master              N/A        N/A
master.mesos.  10.0.4.51                     N/A                    master              N/A        N/A

in multi master environment only the leader master will have REGION and ZONE
displayed. In order to display other master nodes attributes the CLI needs to
know external IP address and this is currently not supported.

* update integration tests

* update node/task.txt files for unit tests

* update `dcos task` sub command output

add REGION and ZONE fields

example:
$ dcos task
NAME  HOST        USER  STATE  ID                                        MESOS ID                                   REGION      ZONE
abc   10.0.2.140  root    R    abc.879dde24-a3ce-11e7-9d44-422fc62916d6  446f21c5-2124-4eee-995b-e637c013ba72-S3  us-west-2  us-west-2b

if fault domain script was not configured, triple dash will be displayed
example:
NAME  HOST        USER  STATE  ID                                        MESOS ID                                 REGION  ZONE
abc   10.0.2.140  root    R    abc.21b24103-a3ce-11e7-9d44-422fc62916d6  446f21c5-2124-4eee-995b-e637c013ba72-S2   ---    ---
bamarni pushed a commit that referenced this pull request Nov 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0