From: Vincent Date: Wed, 17 Aug 2016 03:14:44 +0000 (+0800) Subject: [RM-17053] cleanup: using load_raw to replace old practice X-Git-Tag: v1.5.36~5^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ef3b5126f9fe3b092207cd6188b7474499725dd7;p=ceph-deploy.git [RM-17053] cleanup: using load_raw to replace old practice Signed-off-by: MinSheng Lin --- diff --git a/ceph_deploy/admin.py b/ceph_deploy/admin.py index 7a622b6..7212a1b 100644 --- a/ceph_deploy/admin.py +++ b/ceph_deploy/admin.py @@ -1,10 +1,4 @@ import logging - -try: - from cStringIO import StringIO -except ImportError: - from io import StringIO - from ceph_deploy import exc from ceph_deploy import conf from ceph_deploy.cliutil import priority @@ -14,9 +8,7 @@ LOG = logging.getLogger(__name__) def admin(args): - cfg = conf.ceph.load(args) - conf_data = StringIO() - cfg.write(conf_data) + conf_data = conf.ceph.load_raw(args) try: with open('%s.client.admin.keyring' % args.cluster, 'rb') as f: @@ -33,7 +25,7 @@ def admin(args): distro.conn.remote_module.write_conf( args.cluster, - conf_data.getvalue(), + conf_data, args.overwrite_conf, ) diff --git a/ceph_deploy/hosts/common.py b/ceph_deploy/hosts/common.py index 2de3d20..4747559 100644 --- a/ceph_deploy/hosts/common.py +++ b/ceph_deploy/hosts/common.py @@ -1,10 +1,6 @@ from ceph_deploy.util import paths from ceph_deploy import conf from ceph_deploy.lib import remoto -try: - from cStringIO import StringIO -except ImportError: - from io import StringIO from ceph_deploy.util import constants @@ -24,14 +20,12 @@ def mon_create(distro, args, monitor_keyring, hostname): done_path = paths.mon.done(args.cluster, hostname) init_path = paths.mon.init(args.cluster, hostname, distro.init) - configuration = conf.ceph.load(args) - conf_data = StringIO() - configuration.write(conf_data) + conf_data = conf.ceph.load_raw(args) # write the configuration file distro.conn.remote_module.write_conf( args.cluster, - conf_data.getvalue(), + conf_data, args.overwrite_conf, ) @@ -90,14 +84,12 @@ def mon_add(distro, args, monitor_keyring): done_path = paths.mon.done(args.cluster, hostname) init_path = paths.mon.init(args.cluster, hostname, distro.init) - configuration = conf.ceph.load(args) - conf_data = StringIO() - configuration.write(conf_data) + conf_data = conf.ceph.load_raw(args) # write the configuration file distro.conn.remote_module.write_conf( args.cluster, - conf_data.getvalue(), + conf_data, args.overwrite_conf, ) diff --git a/ceph_deploy/mds.py b/ceph_deploy/mds.py index 2ea7382..b681528 100644 --- a/ceph_deploy/mds.py +++ b/ceph_deploy/mds.py @@ -1,7 +1,3 @@ -try: - from cStringIO import StringIO -except ImportError: - from io import StringIO import errno import logging import os @@ -145,7 +141,7 @@ def create_mds(distro, name, cluster, init): def mds_create(args): - cfg = conf.ceph.load(args) + conf_data = conf.ceph.load_raw(args) LOG.debug( 'Deploying mds, cluster %s hosts %s', args.cluster, @@ -174,11 +170,9 @@ def mds_create(args): if hostname not in bootstrapped: bootstrapped.add(hostname) LOG.debug('deploying mds bootstrap to %s', hostname) - conf_data = StringIO() - cfg.write(conf_data) distro.conn.remote_module.write_conf( args.cluster, - conf_data.getvalue(), + conf_data, args.overwrite_conf, ) diff --git a/ceph_deploy/rgw.py b/ceph_deploy/rgw.py index e9a1fe3..c6b9e0b 100644 --- a/ceph_deploy/rgw.py +++ b/ceph_deploy/rgw.py @@ -1,7 +1,3 @@ -try: - from cStringIO import StringIO -except ImportError: - from io import StringIO import errno import logging import os @@ -141,7 +137,7 @@ def create_rgw(distro, name, cluster, init): def rgw_create(args): - cfg = conf.ceph.load(args) + conf_data = conf.ceph.load_raw(args) LOG.debug( 'Deploying rgw, cluster %s hosts %s', args.cluster, @@ -167,11 +163,9 @@ def rgw_create(args): if hostname not in bootstrapped: bootstrapped.add(hostname) LOG.debug('deploying rgw bootstrap to %s', hostname) - conf_data = StringIO() - cfg.write(conf_data) distro.conn.remote_module.write_conf( args.cluster, - conf_data.getvalue(), + conf_data, args.overwrite_conf, )