diff options
author | Soren Hansen <soren@canonical.com> | 2009-08-11 09:15:31 +0200 |
---|---|---|
committer | Soren Hansen <soren@canonical.com> | 2009-08-11 09:15:31 +0200 |
commit | fbe0de099e1ec2a87d0a826bee95121f1845a519 (patch) | |
tree | ac2ae1a4681b38f52d46faf517cba795bf547486 /ec2init/__init__.py | |
parent | 52cf8361ab8ea2e5bb6f1db21e76d9c652df0b4c (diff) | |
download | vyos-cloud-init-fbe0de099e1ec2a87d0a826bee95121f1845a519.tar.gz vyos-cloud-init-fbe0de099e1ec2a87d0a826bee95121f1845a519.zip |
Extend config API to allow for default values.
Handle undefined config values gracefully.
Diffstat (limited to 'ec2init/__init__.py')
-rw-r--r-- | ec2init/__init__.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ec2init/__init__.py b/ec2init/__init__.py index 0288c06e..5c316770 100644 --- a/ec2init/__init__.py +++ b/ec2init/__init__.py @@ -53,14 +53,14 @@ class EC2Init(): os.system(bailout_command) return False - def get_cfg_option_bool(self, key): - val = self.config[key] + def get_cfg_option_bool(self, key, default=None): + val = self.config.get(key, default) if val.lower() in ['1', 'on', 'yes']: return True return False - def get_cfg_option_str(self, key): - return config[key] + def get_cfg_option_str(self, key, default=None): + return self.config.get(key, default) def get_ssh_keys(self): conn = urllib2.urlopen('%s/public-keys/' % self.meta_data_base_url) |