mirror of https://github.com/ceph/ceph-ansible.git
Merge pull request #2050 from ceph/sort_dict
ceph-defaults: fix handlers that are always triggeredpull/2067/merge
commit
013bc6454f
|
@ -26,7 +26,7 @@ from ansible import errors
|
|||
from ansible.runner.return_data import ReturnData
|
||||
from ansible import utils
|
||||
from ansible.utils import template
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
CONFIG_TYPES = {
|
||||
'ini': 'return_config_overrides_ini',
|
||||
|
@ -145,14 +145,14 @@ class ConfigTemplateParser(ConfigParser.RawConfigParser):
|
|||
def write(self, fp):
|
||||
if self._defaults:
|
||||
fp.write("[%s]\n" % 'DEFAULT')
|
||||
for key, value in self._defaults.items():
|
||||
for key, value in OrderedDict(sorted(self._defaults.items())).items():
|
||||
self._write_check(fp, key=key, value=value)
|
||||
else:
|
||||
fp.write("\n")
|
||||
|
||||
for section in self._sections:
|
||||
fp.write("[%s]\n" % section)
|
||||
for key, value in self._sections[section].items():
|
||||
for key, value in OrderedDict(sorted(self._sections[section].items())).items():
|
||||
self._write_check(fp, key=key, value=value, section=True)
|
||||
else:
|
||||
fp.write("\n")
|
||||
|
|
|
@ -37,7 +37,7 @@ from ansible.plugins.action import ActionBase
|
|||
from ansible.utils.unicode import to_bytes, to_unicode
|
||||
from ansible import constants as C
|
||||
from ansible import errors
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
CONFIG_TYPES = {
|
||||
'ini': 'return_config_overrides_ini',
|
||||
|
@ -173,14 +173,14 @@ class ConfigTemplateParser(ConfigParser.RawConfigParser):
|
|||
def write(self, fp):
|
||||
if self._defaults:
|
||||
fp.write("[%s]\n" % 'DEFAULT')
|
||||
for key, value in self._defaults.items():
|
||||
for key, value in OrderedDict(sorted(self._defaults.items())).items():
|
||||
self._write_check(fp, key=key, value=value)
|
||||
else:
|
||||
fp.write("\n")
|
||||
|
||||
for section in self._sections:
|
||||
fp.write("[%s]\n" % section)
|
||||
for key, value in self._sections[section].items():
|
||||
for key, value in OrderedDict(sorted(self._sections[section].items())).items():
|
||||
self._write_check(fp, key=key, value=value, section=True)
|
||||
else:
|
||||
fp.write("\n")
|
||||
|
|
Loading…
Reference in New Issue