Skip to content
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

[mesos_slave] Do not fail if no cluster name #1843

Merged
merged 2 commits into from
Aug 19, 2015

Conversation

DorianZaccaria
Copy link
Contributor

If the cluster doesn't have a name the check shouldn't fail.

If the cluster doesn't have a name the check shouldn't fail.
@@ -135,7 +135,7 @@ def _get_constant_attributes(self, url, timeout):
if state_metrics is not None:
self.version = map(int, state_metrics['version'].split('.'))
master_state = self._get_state('http://' + state_metrics['master_hostname'] + ':5050', timeout)
if master_state is not None:
if master_state is not None and 'cluster' in master_state:
self.cluster_name = master_state['cluster']
Copy link
Member

Choose a reason for hiding this comment

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

if master_state is not None and 'cluster' in master_state:
    self.cluster_name = master_state['cluster']

could be simplified:

if master_state :
    self.cluster_name = master_state.get('cluster')

I am pretty sure we can drop the if statement too, and have simply:

 self.cluster_name = master_state.get('cluster') 

as master_state could not be null at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if the get master state fails?

@yannmh
Copy link
Member

yannmh commented Aug 19, 2015

LGTM 🌵. Thanks for tackling this issue.

I just made a tiny/nitpick comment.

Feel free to merge it.

DorianZaccaria added a commit that referenced this pull request Aug 19, 2015
[mesos_slave] Do not fail if no cluster name
@DorianZaccaria DorianZaccaria merged commit 598d340 into master Aug 19, 2015
@DorianZaccaria DorianZaccaria deleted the dorian/mesos_slave_no_cluster_name branch August 19, 2015 21:33
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.

2 participants