'plan %s final' % self.name)
def dump(self):
- return json.dumps(self.inc.dump(), indent=4)
+ return json.dumps(self.inc.dump(), indent=4, sort_keys=True)
def show(self):
ls = []
'optimize_result': self.optimize_result,
'mode': self.get_module_option('mode'),
}
- return (0, json.dumps(s, indent=4), '')
+ return (0, json.dumps(s, indent=4, sort_keys=True), '')
elif command['prefix'] == 'balancer mode':
if command['mode'] == 'upmap':
min_compat_client = self.get_osdmap().dump().get('require_min_compat_client', '')
should_prune = True
if should_prune: # some pools were gone, prune
self.set_module_option('pool_ids', ','.join(final_ids))
- return (0, json.dumps(final_names, indent=4), '')
+ return (0, json.dumps(final_names, indent=4, sort_keys=True), '')
elif command['prefix'] == 'balancer pool add':
raw_names = command['pools']
pool_id_by_name = dict((p['pool_name'], p['pool']) for p in self.get_osdmap().dump().get('pools', []))
self.plans = {}
return (0, '', '')
elif command['prefix'] == 'balancer ls':
- return (0, json.dumps([p for p in self.plans], indent=4), '')
+ return (0, json.dumps([p for p in self.plans], indent=4, sort_keys=True), '')
elif command['prefix'] == 'balancer dump':
plan = self.plans.get(command['plan'])
if not plan:
'current_name': s.container_image_name,
'current_id': s.container_image_id,
}
- return trivial_result(json.dumps(r, indent=4))
+ return trivial_result(json.dumps(r, indent=4, sort_keys=True))
crash = self.crashes.get(crashid)
if not crash:
return errno.EINVAL, '', 'crash info: %s not found' % crashid
- val = json.dumps(crash, indent=4)
+ val = json.dumps(crash, indent=4, sort_keys=True)
return 0, val, ''
def do_post(self, cmd, inbuf):
if 'archived' not in crash]
r = sorted(t, key=lambda i: i.get('crash_id'))
if cmd.get('format') == 'json' or cmd.get('format') == 'json-pretty':
- return 0, json.dumps(r, indent=4), ''
+ return 0, json.dumps(r, indent=4, sort_keys=True), ''
else:
table = PrettyTable(['ID', 'ENTITY', 'NEW'],
border=False)
pname = "unknown"
report[pname] += 1
- return 0, '', json.dumps(report)
+ return 0, '', json.dumps(report, sort_keys=True)
def self_test(self):
# test time conversion
def _show_prediction_config(self, cmd):
self.show_module_config()
- return 0, json.dumps(self.config, indent=4), ''
+ return 0, json.dumps(self.config, indent=4, sort_keys=True), ''
def _set_ssl_target_name(self, cmd):
str_ssl_target = cmd.get('ssl_target_name', '')
'df_stats': df_stats
}
- return json.dumps(result, indent=2)
+ return json.dumps(result, indent=2, sort_keys=True)
def handle_command(self, inbuf, cmd):
if cmd['prefix'] == 'influx config-show':
- return 0, json.dumps(self.config), ''
+ return 0, json.dumps(self.config, sort_keys=True), ''
elif cmd['prefix'] == 'influx config-set':
key = cmd['key']
value = cmd['value']
stdout=json.dumps({
'ident': list(self.ident),
'fault': list(self.fault)
- }, indent=4))
+ }, indent=4, sort_keys=True))
def light_on(self, fault_ident, devid):
# type: (str, str) -> HandleCommandResult
if format == 'json':
hosts = [dict(host=node.name, labels=node.labels)
for node in completion.result]
- output = json.dumps(hosts)
+ output = json.dumps(hosts, sort_keys=True)
else:
table = PrettyTable(
['HOST', 'LABELS'],
ps, root_map, pool_root = self._get_pool_status(osdmap, pools)
if cmd.get('format') == 'json' or cmd.get('format') == 'json-pretty':
- return 0, json.dumps(ps, indent=2), ''
+ return 0, json.dumps(ps, indent=4, sort_keys=True), ''
else:
table = PrettyTable(['POOL', 'SIZE', 'TARGET SIZE',
'RATE', 'RAW CAPACITY',
))
self.log.debug(
- "old_up_acting: {0}".format(json.dumps(old_up_acting, indent=2)))
+ "old_up_acting: {0}".format(json.dumps(old_up_acting, indent=4, sort_keys=True)))
# Has this OSD been assigned a new location?
# (it might not be if there is no suitable place to move
self.log.debug(
"new_up_acting: {0}".format(json.dumps(new_up_acting,
- indent=2)))
+ indent=4,
+ sort_keys=True)))
if was_on_out_or_in_osd and is_relocated:
# This PG is now in motion, track its progress
# that never finishes)
return self._handle_clear()
elif cmd['prefix'] == "progress json":
- return 0, json.dumps(self._json(), indent=2), ""
+ return 0, json.dumps(self._json(), indent=4, sort_keys=True), ""
else:
raise NotImplementedError(cmd['prefix'])
task.refs[TASK_REF_POOL_NAMESPACE]):
result.append(task.to_dict())
- return 0, json.dumps(result), ""
+ return 0, json.dumps(result, indent=4, sort_keys=True), ""
def handle_command(self, inbuf, prefix, cmd):
with self.lock:
self.refresh_keys()
return (
0,
- json.dumps(self.keys, indent=2),
+ json.dumps(self.keys, indent=4, sort_keys=True),
"",
)
r = {}
for opt in self.MODULE_OPTIONS:
r[opt['name']] = getattr(self, opt['name'])
- return 0, json.dumps(r, indent=4), ''
+ return 0, json.dumps(r, indent=4, sort_keys=True), ''
elif command['prefix'] == 'telemetry on':
if command.get('license') != LICENSE:
return -errno.EPERM, '', "Telemetry data is licensed under the " + LICENSE_NAME + " (" + LICENSE_URL + ").\nTo enable, add '--license " + LICENSE + "' to the 'ceph telemetry on' command."
report = self.compile_report(
channels=command.get('channels', None)
)
- return 0, json.dumps(report, indent=4), ''
+ return 0, json.dumps(report, indent=4, sort_keys=True), ''
else:
return (-errno.EINVAL, '',
"Command not found '{0}'".format(command['prefix']))
fs_map = self.mgr.get("fs_map")
for f in fs_map['filesystems']:
result.append({'name': f['mdsmap']['fs_name']})
- return 0, json.dumps(result, indent=2), ""
+ return 0, json.dumps(result, indent=4, sort_keys=True), ""
def group_exists(self, sv, spec):
# default group need not be explicitly created (as it gets created
namedict = []
for i in range(len(names)):
namedict.append({'name': names[i].decode('utf-8')})
- return json.dumps(namedict, indent=2)
+ return json.dumps(namedict, indent=4, sort_keys=True)
### subvolume operations
def handle_command(self, inbuf, command):
if command['prefix'] == 'zabbix config-show':
- return 0, json.dumps(self.config), ''
+ return 0, json.dumps(self.config, index=4, sort_keys=True), ''
elif command['prefix'] == 'zabbix config-set':
key = command['key']
value = command['value']