to be doing try/except {ConfigParser Exceptions} every time.
"""
try:
- #Use full parent function so we can replace it in the class
+ #Use full parent function so we can replace it in the class
# if desired
return ConfigParser.RawConfigParser.get(self, section, key)
except (ConfigParser.NoSectionError,
return parse(f)
+def load_raw(args):
+ """
+ Read the actual file *as is* without parsing/modifiying it
+ so that it can be written maintaining its same properties.
+ """
+ path = '{cluster}.conf'.format(cluster=args.cluster)
+ try:
+ with open(path) as ceph_conf:
+ return ceph_conf.read()
+ except (IOError, OSError) as e:
+ raise exc.ConfigError(e)
+
+
def write_conf(cluster, conf, overwrite):
""" write cluster configuration to /etc/ceph/{cluster}.conf """
import os