1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-21 18:03:54 +03:00

Merge remote-tracking branch 'origin/v4.0'

This commit is contained in:
Adolfo Gómez García 2024-12-16 19:25:42 +01:00
commit c9201c91a3
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23

View File

@ -74,19 +74,20 @@ class Command(BaseCommand):
writer = {} # Create a dict to store data, and write at the end
# Get sections, key, value as a list of tuples
for section, data in config.Config.get_config_values().items():
str_section = str(section)
for key, value in data.items():
# value is a dict, get 'value' key
if options['csv']:
writer.writerow([section, key, value['value']])
writer.writerow([str_section, key, value['value']])
elif options['yaml']:
if section not in writer:
writer[section] = {}
writer[section][key] = value['value']
if str_section not in writer:
writer[str_section] = {}
writer[str_section][key] = value['value']
else:
v = value['value'].replace('\n', '\\n')
self.stdout.write(f'{section}.{key}="{v}"')
if options['yaml']:
self.stdout.write(yaml.safe_dump(writer, default_flow_style=False))
self.stdout.write(yaml.safe_dump(writer, default_flow_style=False))
except Exception as e:
self.stdout.write(f'The command could not be processed: {e}')
self.stdout.flush()