Skip to content

Commit

Permalink
Merge pull request #180 from mesosphere/dcos_tasks_dcos_url
Browse files Browse the repository at this point in the history
support core.dcos_url in `dcos tasks`
  • Loading branch information
ssk2 committed May 21, 2015
2 parents 8e1d092 + e6316ee commit 0620cdf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions cli/tests/integrations/cli/test_package.py
Expand Up @@ -329,12 +329,12 @@ def test_package_metadata():

def test_install_with_id():
args = ['--app-id=chronos-1']
stdout = (b"""Installing package [chronos] version [2.3.3] with app """
stdout = (b"""Installing package [chronos] version [2.3.4] with app """
b"""id [chronos-1]\n""")
_install_chronos(args=args, stdout=stdout)

args = ['--app-id=chronos-2']
stdout = (b"""Installing package [chronos] version [2.3.3] with app """
stdout = (b"""Installing package [chronos] version [2.3.4] with app """
b"""id [chronos-2]\n""")
_install_chronos(args=args, stdout=stdout)

Expand Down Expand Up @@ -448,7 +448,7 @@ def test_list_installed():
"mesosphere",
"framework"
],
"version": "2.3.3"
"version": "2.3.4"
}
]
"""
Expand Down Expand Up @@ -611,7 +611,7 @@ def _uninstall_chronos(args=[], returncode=0, stdout=b'', stderr=b''):
def _install_chronos(
args=[],
returncode=0,
stdout=b'Installing package [chronos] version [2.3.3]\n',
stdout=b'Installing package [chronos] version [2.3.4]\n',
stderr=b'',
postInstallNotes=b'Chronos DCOS Service has been successfully '
b'installed!\nWe recommend a minimum of one node '
Expand Down
16 changes: 12 additions & 4 deletions dcos/mesos.py
Expand Up @@ -23,9 +23,17 @@ def get_master(config=None):
if config is None:
config = util.get_config()

mesos_master_url = util.get_config_vals(
config, ['core.mesos_master_url'])[0]
return MesosMaster(mesos_master_url)
mesos_url = get_mesos_url(config)
return MesosMaster(mesos_url)


def get_mesos_url(config):
mesos_master_url = config.get('core.mesos_master_url')
if mesos_master_url is None:
dcos_url = util.get_config_vals(config, ['core.dcos_url'])[0]
return urllib.parse.urljoin(dcos_url, 'mesos/')
else:
return mesos_master_url


MESOS_TIMEOUT = 3
Expand All @@ -51,7 +59,7 @@ def state(self):
"""

if not self._state:
self._state = self.fetch('/master/state.json').json()
self._state = self.fetch('master/state.json').json()
return self._state

def slave(self, fltr):
Expand Down

0 comments on commit 0620cdf

Please sign in to comment.