summaryrefslogtreecommitdiff
path: root/cloudinit/cfg.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 13:15:34 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 13:15:34 -0700
commit7d5a292d293e9ae4b06b6ee00926fe46b1d7ad73 (patch)
treeff6a28f357a50f66a202a5a53233c40738bda45f /cloudinit/cfg.py
parent457b9998d760150efb17658f9a0fd4816417577e (diff)
downloadvyos-cloud-init-7d5a292d293e9ae4b06b6ee00926fe46b1d7ad73.tar.gz
vyos-cloud-init-7d5a292d293e9ae4b06b6ee00926fe46b1d7ad73.zip
Add comment as to why this cfg class is useful
Diffstat (limited to 'cloudinit/cfg.py')
-rw-r--r--cloudinit/cfg.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/cloudinit/cfg.py b/cloudinit/cfg.py
index dd8f7baf..215ed855 100644
--- a/cloudinit/cfg.py
+++ b/cloudinit/cfg.py
@@ -20,6 +20,14 @@ import io
from ConfigParser import (NoSectionError, NoOptionError, RawConfigParser)
+# This config parser will not throw when sections don't exist
+# and you are setting values on those sections which is useful
+# when writing to new options that may not have corresponding
+# sections. Also it can default other values when doing gets
+# so that if those sections/options do not exist you will
+# get a default instead of an error. Another useful case where
+# you can avoid catching exceptions that you typically don't
+# care about...
class DefaultingConfigParser(RawConfigParser):
DEF_INT = 0