Skip to content

Commit

Permalink
Merge pull request buildbot#3059 from Cray/update-worker-umask-docs
Browse files Browse the repository at this point in the history
Turn 022 to 0o22
  • Loading branch information
seankelly authored Mar 20, 2017
2 parents fb8f092 + 555a3c3 commit c3667ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions worker/buildbot_worker/scripts/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class CreateWorkerOptions(MakerBase):
"Interval at which keepalives should be sent (in seconds)"],
["umask", None, "None",
"controls permissions of generated files. "
"Use --umask=022 to be world-readable"],
"Use --umask=0o22 to be world-readable"],
["maxdelay", None, 300,
"Maximum time between connection attempts"],
["numcpus", None, "None",
Expand Down Expand Up @@ -166,7 +166,7 @@ def validateMasterArgument(self, master_arg):
port = int(port)
except ValueError:
raise usage.UsageError("invalid master port '%s', "
"needs to be an number" % port)
"needs to be a number" % port)

return master, port

Expand All @@ -191,22 +191,22 @@ def postOptions(self):
try:
self[argument] = int(self[argument])
except ValueError:
raise usage.UsageError("%s parameter needs to be an number"
raise usage.UsageError("%s parameter needs to be a number"
% argument)

if not re.match(r'^\d+$', self['log-count']) and \
self['log-count'] != 'None':
raise usage.UsageError("log-count parameter needs to be an number"
raise usage.UsageError("log-count parameter needs to be a number"
" or None")

if not re.match(r'^\d+$', self['umask']) and \
if not re.match(r'^(0o)?\d+$', self['umask']) and \
self['umask'] != 'None':
raise usage.UsageError("umask parameter needs to be an number"
raise usage.UsageError("umask parameter needs to be a number"
" or None")

if not re.match(r'^\d+$', self['numcpus']) and \
self['numcpus'] != 'None':
raise usage.UsageError("numcpus parameter needs to be an number"
raise usage.UsageError("numcpus parameter needs to be a number"
" or None")

if self['allow-shutdown'] not in [None, 'signal', 'file']:
Expand Down
18 changes: 9 additions & 9 deletions worker/buildbot_worker/test/unit/test_scripts_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ def test_all_args(self):
self.patch(runner.MakerBase, "postOptions", mock.Mock())

opts = self.parse("--force", "--relocatable", "--no-logrotate",
"--keepalive=4", "--umask=022",
"--keepalive=4", "--umask=0o22",
"--maxdelay=3", "--numcpus=4", "--log-size=2", "--log-count=1",
"--allow-shutdown=file", *self.req_args)
self.assertOptions(opts,
{"force": True,
"relocatable": True,
"no-logrotate": True,
"umask": "022",
"umask": "0o22",
"maxdelay": 3,
"numcpus": "4",
"log-size": 2,
Expand All @@ -205,32 +205,32 @@ def test_master_url(self):

def test_inv_keepalive(self):
self.assertRaisesRegex(usage.UsageError,
"keepalive parameter needs to be an number",
"keepalive parameter needs to be a number",
self.parse, "--keepalive=X", *self.req_args)

def test_inv_maxdelay(self):
self.assertRaisesRegex(usage.UsageError,
"maxdelay parameter needs to be an number",
"maxdelay parameter needs to be a number",
self.parse, "--maxdelay=X", *self.req_args)

def test_inv_log_size(self):
self.assertRaisesRegex(usage.UsageError,
"log-size parameter needs to be an number",
"log-size parameter needs to be a number",
self.parse, "--log-size=X", *self.req_args)

def test_inv_log_count(self):
self.assertRaisesRegex(usage.UsageError,
"log-count parameter needs to be an number or None",
"log-count parameter needs to be a number or None",
self.parse, "--log-count=X", *self.req_args)

def test_inv_numcpus(self):
self.assertRaisesRegex(usage.UsageError,
"numcpus parameter needs to be an number or None",
"numcpus parameter needs to be a number or None",
self.parse, "--numcpus=X", *self.req_args)

def test_inv_umask(self):
self.assertRaisesRegex(usage.UsageError,
"umask parameter needs to be an number or None",
"umask parameter needs to be a number or None",
self.parse, "--umask=X", *self.req_args)

def test_inv_allow_shutdown(self):
Expand Down Expand Up @@ -276,7 +276,7 @@ def test_validateMasterArgument_inv_port(self):
opts = runner.CreateWorkerOptions()
self.assertRaisesRegex(usage.UsageError,
"invalid master port 'apple', "
"needs to be an number",
"needs to be a number",
opts.validateMasterArgument, "host:apple")

def test_validateMasterArgument_ok(self):
Expand Down

0 comments on commit c3667ae

Please sign in to comment.