Registers in open rc configs are fixed #37

master
Иванов Денис 3 years ago
parent 79ee3146e7
commit debf717481

@ -59,14 +59,20 @@ class OpenRCFormat(Format):
self._join(self._document_dictionary,
template._document_dictionary,
self._join_before)
print('AFTER JOIN')
self.print_dictionary()
def _correct_register(self, template: "OpenRCFormat") -> dict:
'''Метод для корректировки всех регистров.'''
corrected_dict = OrderedDict()
template_keys = {key[1].lower(): key[1] for key
in template._document_dictionary.keys()}
return self._document_dictionary
for key, value in self._document_dictionary.items():
if key[1].lower() in template_keys:
corrected_dict[('', template_keys[key[1].lower()])] = value
else:
corrected_dict[key] = value
return corrected_dict
@classmethod
def _initialize_parser(cls):

@ -307,3 +307,33 @@ INSTANCE="openldap${SVCNAME#slapd}"
template_object = OpenRCFormat(template_text, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == join_result
def test_register_changing(self):
original = '''PARAM=1
param2=2
BIG_PARAM=1
low_param=2'''
template = '''big_param=3
LOW_PARAM=4
new_param=5
NEW_PARAM2=6'''
result = '''PARAM=1
param2=2
big_param=3
LOW_PARAM=4
new_param=5
NEW_PARAM2=6
'''
original_object = OpenRCFormat(original, '/path/to/template')
template_object = OpenRCFormat(template, '/path/to/template')
original_object.join_template(template_object)
assert original_object.document_text == result

@ -5,7 +5,7 @@ rc_tty_number=12
# The following setting turns on the memory.use_hierarchy setting in the
# root memory cgroup for cgroups v1.
# It must be set to yes in this file if you want this functionality.
rc_cgroup_memory_use_hierarchy="YES"
RC_CGROUP_MEMORY_USE_HIERARCHY="YES"
# Multiple settings and values can be specified.
# For example, you would use this to set the maximum memory and maximum
@ -13,10 +13,10 @@ rc_cgroup_memory_use_hierarchy="YES"
rc_cgroup_settings="10485760"
# If you have multiple slapd instances per #376699, this will provide a default config
instance="openldap${SVCNAME#slapd}"
INSTANCE="openldap${SVCNAME#slapd}"
# If you use the classical configuration file:
opts_conf="-f /etc/${INSTANCE}/slapd.conf"
OPTS_CONF="-f /etc/${INSTANCE}/slapd.conf"
# Specify the kerberos keytab file
#KRB5_KTNAME=/etc/openldap/krb5-ldap.keytab

@ -1,6 +1,6 @@
# It must be set to yes in this file if you want this functionality.
rc_cgroup_memory_use_hierarchy="YES"
RC_CGROUP_MEMORY_USE_HIERARCHY="YES"
clock="Any Clock Type"

Loading…
Cancel
Save