]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/restful: updated string formatting to str.format()
authorJames McClune <jmcclune@mcclunetechnologies.net>
Wed, 30 Jan 2019 21:01:22 +0000 (16:01 -0500)
committerJames McClune <jmcclune@mcclunetechnologies.net>
Wed, 13 Feb 2019 18:06:10 +0000 (13:06 -0500)
Made changes per @tchaikov's request

Signed-off-by: James McClune <jmcclune@mcclunetechnologies.net>
src/pybind/mgr/restful/api/config.py
src/pybind/mgr/restful/api/mon.py
src/pybind/mgr/restful/api/osd.py
src/pybind/mgr/restful/api/pool.py
src/pybind/mgr/restful/api/request.py

index f19634da5c071a3d522089ed5b95e1a725233148..565896c879e6d439e0335b4d09d3a02c875828b3 100644 (file)
@@ -33,7 +33,7 @@ class ConfigOsd(RestController):
         valid_flags = set(args.keys()) & set(common.OSD_FLAGS)
         invalid_flags = list(set(args.keys()) - valid_flags)
         if invalid_flags:
-            context.instance.log.warn("%s not valid to set/unset" % invalid_flags)
+            context.instance.log.warn("%s not valid to set/unset", invalid_flags)
 
         for flag in list(valid_flags):
             if args[flag]:
index 807d6df3bf790e9a5978fe0da266f815d4e9b74a..341f7037769e8c8efaead30d0e230a9b53f5a143 100644 (file)
@@ -23,7 +23,7 @@ class MonName(RestController):
 
         if len(mon) != 1:
             response.status = 500
-            return {'message': 'Failed to identify the monitor node "%s"' % self.name}
+            return {'message': 'Failed to identify the monitor node "{}"'.format(self.name)}
 
         return mon[0]
 
index 99f9ed4c8e72e52476cbc72b10ea11c9ea1e2956..8577fae98eb406733ee6832d1f1ad6aa5e1735f9 100644 (file)
@@ -20,7 +20,7 @@ class OsdIdCommand(RestController):
 
         if not osd:
             response.status = 500
-            return {'message': 'Failed to identify the OSD id "%d"' % self.osd_id}
+            return {'message': 'Failed to identify the OSD id "{}"'.format(self.osd_id)}
 
         if osd['up']:
             return common.OSD_IMPLEMENTED_COMMANDS
@@ -40,11 +40,11 @@ class OsdIdCommand(RestController):
 
         if not osd:
             response.status = 500
-            return {'message': 'Failed to identify the OSD id "%d"' % self.osd_id}
+            return {'message': 'Failed to identify the OSD id "{}"'.format(self.osd_id)}
 
         if not osd['up'] or command not in common.OSD_IMPLEMENTED_COMMANDS:
             response.status = 500
-            return {'message': 'Command "%s" not available' % command}
+            return {'message': 'Command "{}" not available'.format(command)}
 
         return context.instance.submit_request([[{
             'prefix': 'osd ' + command,
@@ -68,7 +68,7 @@ class OsdId(RestController):
         osd = context.instance.get_osds(ids=[str(self.osd_id)])
         if len(osd) != 1:
             response.status = 500
-            return {'message': 'Failed to identify the OSD id "%d"' % self.osd_id}
+            return {'message': 'Failed to identify the OSD id "{}"'.format(self.osd_id)}
 
         return osd[0]
 
index b7a771810d573a6f0fd73f868f13e3802fed7136..40de54eb957790f63d20b57aeddf06e4f1d69e78 100644 (file)
@@ -20,7 +20,7 @@ class PoolId(RestController):
 
         if not pool:
             response.status = 500
-            return {'message': 'Failed to identify the pool id "%d"' % self.pool_id}
+            return {'message': 'Failed to identify the pool id "{}"'.format(self.pool_id)}
 
         # pgp_num is called pg_placement_num, deal with that
         if 'pg_placement_num' in pool:
@@ -44,13 +44,13 @@ class PoolId(RestController):
         pool = context.instance.get_pool_by_id(self.pool_id)
         if not pool:
             response.status = 500
-            return {'message': 'Failed to identify the pool id "%d"' % self.pool_id}
+            return {'message': 'Failed to identify the pool id "{}"'.format(self.pool_id)}
 
         # Check for invalid pool args
         invalid = common.invalid_pool_args(args)
         if invalid:
             response.status = 500
-            return {'message': 'Invalid arguments found: "%s"' % str(invalid)}
+            return {'message': 'Invalid arguments found: "{}"'.format(invalid)}
 
         # Schedule the update request
         return context.instance.submit_request(common.pool_update_commands(pool['pool_name'], args), **kwargs)
@@ -66,7 +66,7 @@ class PoolId(RestController):
 
         if not pool:
             response.status = 500
-            return {'message': 'Failed to identify the pool id "%d"' % self.pool_id}
+            return {'message': 'Failed to identify the pool id "{}"'.format(self.pool_id)}
 
         return context.instance.submit_request([[{
             'prefix': 'osd pool delete',
@@ -125,7 +125,7 @@ class Pool(RestController):
         invalid = common.invalid_pool_args(args)
         if invalid:
             response.status = 500
-            return {'message': 'Invalid arguments found: "%s"' % str(invalid)}
+            return {'message': 'Invalid arguments found: "{}"'.format(invalid)}
 
         # Schedule the creation and update requests
         return context.instance.submit_request(
index 82c7fe16a75da0ef15b9bd95cc4dd677e5a0191a..486c6303f52613ebca96233222f8203ebfcf7564 100644 (file)
@@ -23,7 +23,7 @@ class RequestId(RestController):
 
         if len(request) != 1:
             response.status = 500
-            return {'message': 'Unknown request id "%s"' % str(self.request_id)}
+            return {'message': 'Unknown request id "{}"'.format(self.request_id)}
 
         request = request[0]
         return request