diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-08-27 20:51:00 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-08-27 20:51:00 -0700 |
commit | 2e51e2efc292870479a7b972c7ebc9ceac85da6f (patch) | |
tree | 7ae5688835309fa24c9f0ffe3f6876cbe964591e /cloudinit/util.py | |
parent | 92b99b325b2d437825cc87253e76c756a136ff28 (diff) | |
download | vyos-cloud-init-2e51e2efc292870479a7b972c7ebc9ceac85da6f.tar.gz vyos-cloud-init-2e51e2efc292870479a7b972c7ebc9ceac85da6f.zip |
For the userdata 'post-filtering' add in a new folder that
can contain filters that serve this purpose only and add in
the initial launch-index filter and replace the code in
the datasource class that previously did this.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index 6872cc31..33da73eb 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -1285,12 +1285,15 @@ def ensure_file(path, mode=0644): write_file(path, content='', omode="ab", mode=mode) -def chmod(path, mode): - real_mode = None +def safe_int(possible_int): try: - real_mode = int(mode) + return int(possible_int) except (ValueError, TypeError): - pass + return None + + +def chmod(path, mode): + real_mode = safe_int(mode) if path and real_mode: with SeLinuxGuard(path): os.chmod(path, real_mode) |