Skip to content

Commit

Permalink
quotes around single-user CLI args
Browse files Browse the repository at this point in the history
avoids mishandling things such as integer-literals
  • Loading branch information
minrk committed Nov 1, 2016
1 parent 5163c7a commit 7da7f7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions jupyterhub/spawner.py
Expand Up @@ -298,15 +298,15 @@ def format_string(self, s):
def get_args(self):
"""Return the arguments to be passed after self.cmd"""
args = [
'--user=%s' % self.user.name,
'--cookie-name=%s' % self.user.server.cookie_name,
'--base-url=%s' % self.user.server.base_url,
'--hub-host=%s' % self.hub.host,
'--hub-prefix=%s' % self.hub.server.base_url,
'--hub-api-url=%s' % self.hub.api_url,
'--user="%s"' % self.user.name,
'--cookie-name="%s"' % self.user.server.cookie_name,
'--base-url="%s"' % self.user.server.base_url,
'--hub-host="%s"' % self.hub.host,
'--hub-prefix="%s"' % self.hub.server.base_url,
'--hub-api-url="%s"' % self.hub.api_url,
]
if self.ip:
args.append('--ip=%s' % self.ip)
args.append('--ip="%s"' % self.ip)

if self.port:
args.append('--port=%i' % self.port)
Expand All @@ -316,10 +316,10 @@ def get_args(self):

if self.notebook_dir:
notebook_dir = self.format_string(self.notebook_dir)
args.append('--notebook-dir=%s' % notebook_dir)
args.append('--notebook-dir="%s"' % notebook_dir)
if self.default_url:
default_url = self.format_string(self.default_url)
args.append('--NotebookApp.default_url=%s' % default_url)
args.append('--NotebookApp.default_url="%s"' % default_url)

if self.debug:
args.append('--debug')
Expand Down
4 changes: 2 additions & 2 deletions jupyterhub/tests/test_api.py
Expand Up @@ -390,10 +390,10 @@ def test_spawn(app, io_loop):
r = requests.get(ujoin(url, 'args'))
assert r.status_code == 200
argv = r.json()
for expected in ['--user=%s' % name, '--base-url=%s' % user.server.base_url]:
for expected in ['--user="%s"' % name, '--base-url="%s"' % user.server.base_url]:
assert expected in argv
if app.subdomain_host:
assert '--hub-host=%s' % app.subdomain_host in argv
assert '--hub-host="%s"' % app.subdomain_host in argv

r = api_request(app, 'users', name, 'server', method='delete')
assert r.status_code == 204
Expand Down

0 comments on commit 7da7f7e

Please sign in to comment.