From 9dd1f3a3024bd67341068a225271b11c67ccfc71 Mon Sep 17 00:00:00 2001 From: Adrian Turjak Date: Fri, 7 Aug 2020 17:44:09 +1200 Subject: [PATCH] Update CONFspirator with example and toml support Example config generation now is in CONFspirator so we can instead use that. We now also natively get toml support through the new version of the library. Change-Id: Ic3a46d075dd83e11ee3cccc1ad2bbdb81005c60d --- .../management/commands/exampleconfig.py | 78 +-- adjutant/config/__init__.py | 44 +- doc/source/configuration.rst | 17 +- etc/adjutant.yaml | 597 +++++++----------- releasenotes/notes/toml-d8fba261f61313bf.yaml | 6 + requirements.txt | 3 +- 6 files changed, 269 insertions(+), 476 deletions(-) create mode 100644 releasenotes/notes/toml-d8fba261f61313bf.yaml diff --git a/adjutant/commands/management/commands/exampleconfig.py b/adjutant/commands/management/commands/exampleconfig.py index b52203d..0f26f8d 100644 --- a/adjutant/commands/management/commands/exampleconfig.py +++ b/adjutant/commands/management/commands/exampleconfig.py @@ -1,76 +1,12 @@ -import yaml - from django.core.management.base import BaseCommand -from confspirator import groups +import confspirator from adjutant import config -def make_yaml_lines(val, depth, comment=False): - new_lines = [] - line_prefix = " " * (depth + 1) - for line in yaml.dump(val).split("\n"): - if line == "": - continue - if comment: - new_lines.append(line_prefix + "# %s" % line) - else: - new_lines.append(line_prefix + line) - return new_lines - - -def make_field_lines(field, depth): - field_lines = [] - line_prefix = " " * (depth + 1) - field_type = field.type.__class__.__name__ - field_lines.append(line_prefix + "# %s" % field_type) - field_help_text = "# %s" % field.help_text - field_lines.append(line_prefix + field_help_text) - - default = "" - if field.default is not None: - default = field.default - - if not default and field.sample_default is not None: - default = field.sample_default - - if field_type == "Dict": - if default: - field_lines.append(line_prefix + "%s:" % field.name) - field_lines += make_yaml_lines(default, depth + 1) - else: - field_lines.append(line_prefix + "# %s:" % field.name) - elif field_type == "List": - if default: - field_lines.append(line_prefix + "%s:" % field.name) - field_lines += make_yaml_lines(default, depth + 1) - else: - field_lines.append(line_prefix + "# %s:" % field.name) - else: - if default == "": - field_lines.append(line_prefix + "# %s: " % field.name) - else: - default_str = " " + str(default) - field_lines.append(line_prefix + "%s:%s" % (field.name, default_str)) - return field_lines - - -def make_group_lines(group, depth=0): - group_lines = [] - line_prefix = " " * depth - group_lines.append(line_prefix + "%s:" % group.name) - - for child in group: - if isinstance(child, groups.ConfigGroup): - group_lines += make_group_lines(child, depth=depth + 1) - else: - group_lines += make_field_lines(child, depth) - return group_lines - - class Command(BaseCommand): - help = "" + help = "Produce an example config file for Adjutant." def add_arguments(self, parser): parser.add_argument("--output-file", default="adjutant.yaml") @@ -78,12 +14,4 @@ class Command(BaseCommand): def handle(self, *args, **options): print("Generating example file to: '%s'" % options["output_file"]) - base_lines = [] - for group in config._root_config: - base_lines += make_group_lines(group) - base_lines.append("") - - with open(options["output_file"], "w") as f: - for line in base_lines: - f.write(line) - f.write("\n") + confspirator.create_example_config(config._root_config, options["output_file"]) diff --git a/adjutant/config/__init__.py b/adjutant/config/__init__.py index ee98186..02cd614 100644 --- a/adjutant/config/__init__.py +++ b/adjutant/config/__init__.py @@ -14,9 +14,8 @@ import os import sys -import yaml -from confspirator import load +import confspirator from confspirator import groups from adjutant.config import api @@ -34,7 +33,10 @@ _root_config.register_child_config(notification.config_group) _root_config.register_child_config(workflow.config_group) _root_config.register_child_config(quota.config_group) -_config_file = "/etc/adjutant/adjutant.yaml" +_config_files = [ + "/etc/adjutant/adjutant.yaml", + "/etc/adjutant/adjutant.toml", +] _old_config_file = "/etc/adjutant/conf.yaml" @@ -56,24 +58,27 @@ def _load_config(): else: test_mode = False - config_file_locations = [_config_file, _old_config_file] + config_file_locations = list(_config_files) + config_file_locations.append(_old_config_file) conf_file = os.environ.get("ADJUTANT_CONFIG_FILE", None) if conf_file: config_file_locations.insert(0, conf_file) - conf_dict = None + loaded_config = None used_config_loc = None for conf_file_loc in config_file_locations: try: - with open(conf_file_loc) as f: - # NOTE(adriant): we print because we don't yet know - # where to log to - print("Loading config from '%s'" % conf_file_loc) - conf_dict = yaml.load(f, Loader=yaml.FullLoader) - used_config_loc = conf_file_loc - break + # NOTE(adriant): we print because we don't yet know + # where to log to + if not test_mode: + print("Checking for config at '%s'" % conf_file_loc) + loaded_config = confspirator.load_file( + _root_config, conf_file_loc, test_mode=test_mode + ) + used_config_loc = conf_file_loc + break except IOError: if not test_mode: print( @@ -88,22 +93,21 @@ def _load_config(): ): print( "DEPRECATED: Using the old default config location '%s' is deprecated " - "in favor of '%s', or setting a config location via the environment " - "variable 'ADJUTANT_CONFIG_FILE'." % (_old_config_file, _config_file) + "in favor of one of '%s', or setting a config location via the environment " + "variable 'ADJUTANT_CONFIG_FILE'." % (_old_config_file, _config_files) ) - if conf_dict is None: + if loaded_config is None: if not test_mode: print( "No valid conf file not found, will rely on defaults and " "environment variables.\n" - "Config should be placed at '%s' or a location defined via the " - "environment variable 'ADJUTANT_CONFIG_FILE'." % _config_file + "Config should be placed at one of '%s' or a location defined via the " + "environment variable 'ADJUTANT_CONFIG_FILE'." % _config_files ) - conf_dict = {} + return confspirator.load_dict(_root_config, {}, test_mode=test_mode) - conf_dict = {"adjutant": conf_dict} - return load(_root_config, conf_dict, test_mode=test_mode) + return loaded_config CONF = _load_config() diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst index 5a15f01..44a1076 100644 --- a/doc/source/configuration.rst +++ b/doc/source/configuration.rst @@ -14,14 +14,23 @@ can be generated by running:: tox -e venv -- adjutant-api exampleconfig --output-file /etc/adjutant/adjutant.yaml -With ``--output-file`` controlling where the file goes. +With ``--output-file`` controlling where the file goes. If the file extension +is given as ``toml`` rather than ``yaml``, a toml format config file will be +generated instead. This example file should be your starting point for configuring the service, and your core source of documentation for what each config does. -Adjutant will read the file from ``/etc/adjutant/adjutant.yaml`` or if the -environment variable ``ADJUTANT_CONFIG_FILE`` is set, will look for the file -in the specified location. +Adjutant will read the file from ``/etc/adjutant/adjutant.yaml`` or +``/etc/adjutant/adjutant.toml``, and if the environment variable +``ADJUTANT_CONFIG_FILE`` is set, will look for the file in the +specified location. + +.. note:: + + While Adjutant does support toml as a config format, you are likely + better off sticking with yaml as it may prove easier and more reliable, + but for those who much prefer an ini type format, that might feel closer. Configuration options +++++++++++++++++++++ diff --git a/etc/adjutant.yaml b/etc/adjutant.yaml index b17242a..b56b128 100644 --- a/etc/adjutant.yaml +++ b/etc/adjutant.yaml @@ -1,22 +1,16 @@ django: - # String - # The Django secret key. + # String - The Django secret key. secret_key: Do not ever use this awful secret in prod!!!! - # Boolean - # Django debug mode is turned on. - debug: False - # List - # The Django allowed hosts + # Boolean - Django debug mode is turned on. + debug: false + # List - The Django allowed hosts allowed_hosts: - '*' - # String - # The header representing a HTTP header/value combination that signifies a request is secure. + # String - The header representing a HTTP header/value combination that signifies a request is secure. secure_proxy_ssl_header: HTTP_X_FORWARDED_PROTO - # String - # The value representing a HTTP header/value combination that signifies a request is secure. + # String - The value representing a HTTP header/value combination that signifies a request is secure. secure_proxy_ssl_header_value: https - # Dict - # Django databases config. + # Dict - Django databases config. databases: default: ATOMIC_REQUESTS: false @@ -35,88 +29,67 @@ django: NAME: null TIME_ZONE: null USER: '' - # Dict - # A full override of the Django logging config for more customised logging. + # Dict - A full override of the Django logging config for more customised logging. # logging: - # String - # The name and location of the Adjutant log file, superceded by 'adjutant.django.logging'. + # String - The name and location of the Adjutant log file, superceded by 'adjutant.django.logging'. log_file: adjutant.log email: - # String - # Django email backend to use. + # String - Django email backend to use. email_backend: django.core.mail.backends.console.EmailBackend - # Integer - # Email backend timeout. + # Integer - Email backend timeout. # timeout: - # Hostname - # Email backend server location. + # Hostname - Email backend server location. # host: - # Port - # Email backend server port. + # Port - Email backend server port. # port: - # String - # Email backend user. + # String - Email backend user. # host_user: - # String - # Email backend user password. + # String - Email backend user password. # host_password: - # Boolean - # Whether to use TLS for email. Mutually exclusive with 'use_ssl'. - use_tls: False - # Boolean - # Whether to use SSL for email. Mutually exclusive with 'use_tls'. - use_ssl: False + # Boolean - Whether to use TLS for email. Mutually exclusive with 'use_ssl'. + use_tls: false + # Boolean - Whether to use SSL for email. Mutually exclusive with 'use_tls'. + use_ssl: false identity: - # Integer - # Cache time for Keystone Tokens in the Keystone Middleware. + # Integer - Cache time for Keystone Tokens in the Keystone Middleware. token_cache_time: -1 - # Boolean - # Is Adjutant allowed (or able) to edit users in Keystone. - can_edit_users: True - # Boolean - # Should Adjutant assume and treat all usernames as emails. - username_is_email: True - # Dict - # A mapping from held role to roles it is allowed to manage. + # Boolean - Is Adjutant allowed (or able) to edit users in Keystone. + can_edit_users: true + # Boolean - Should Adjutant assume and treat all usernames as emails. + username_is_email: true + # Dict - A mapping from held role to roles it is allowed to manage. role_mapping: admin: - - project_admin - - project_mod - - heat_stack_owner - - member + - project_admin + - project_mod + - heat_stack_owner + - member project_admin: - - project_admin - - project_mod - - heat_stack_owner - - member + - project_admin + - project_mod + - heat_stack_owner + - member project_mod: - - project_mod - - heat_stack_owner - - member + - project_mod + - heat_stack_owner + - member auth: - # String - # Username for Adjutant Keystone admin user. + # String - Username for Adjutant Keystone admin user. # username: - # String - # Password for Adjutant Keystone admin user. + # String - Password for Adjutant Keystone admin user. # password: - # String - # Project name for Adjutant Keystone admin user. + # String - Project name for Adjutant Keystone admin user. # project_name: - # String - # Project domain id for Adjutant Keystone admin user. + # String - Project domain id for Adjutant Keystone admin user. project_domain_id: default - # String - # User domain id for Adjutant Keystone admin user. + # String - User domain id for Adjutant Keystone admin user. user_domain_id: default - # URI - # Keystone auth url that Adjutant will use. + # URI - Keystone auth url that Adjutant will use. # auth_url: api: - # List - # List of Active Delegate APIs. + # List - List of Active Delegate APIs. active_delegate_apis: - UserRoles - UserDetail @@ -125,328 +98,236 @@ api: - RoleList delegate_apis: CreateProjectAndUser: - # String - # Default region in which any potential resources may be created. + # String - Default region in which any potential resources may be created. default_region: RegionOne - # String - # Domain in which project and users will be created. + # String - Domain in which project and users will be created. default_domain_id: default - # String - # Parent id under which this project will be created. Default is None, and will create under default domain. + # String - Parent id under which this project will be created. Default is None, and will create under default domain. # default_parent_id: UserList: - # List - # Users with any of these roles will be hidden from the user list. + # List - Users with any of these roles will be hidden from the user list. blacklisted_roles: - admin UserDetail: - # List - # User with these roles will return not found. + # List - User with these roles will return not found. blacklisted_roles: - admin UserRoles: - # List - # User with these roles will return not found. + # List - User with these roles will return not found. blacklisted_roles: - admin SignUp: - # String - # Default region in which any potential resources may be created. + # String - Default region in which any potential resources may be created. default_region: RegionOne - # String - # Domain in which project and users will be created. + # String - Domain in which project and users will be created. default_domain_id: default - # String - # Parent id under which this project will be created. Default is None, and will create under default domain. + # String - Parent id under which this project will be created. Default is None, and will create under default domain. # default_parent_id: notifications: handler_defaults: EmailNotification: - # List - # List of email addresses to send this notification to. + # List - List of email addresses to send this notification to. # emails: - # String - # From email for this notification. + # String - From email for this notification. from: bounce+%(task_uuid)s@example.com - # String - # Reply-to email for this notification. + # String - Reply-to email for this notification. reply: no-reply@example.com - # String - # Email template for this notification. No template will cause the email not to send. + # String - Email template for this notification. No template will cause the email not to send. template: notification.txt - # String - # Email html template for this notification. + # String - Email html template for this notification. # html_template: workflow: - # URI - # The base Horizon url for Adjutant to use when producing links to Horizon. + # URI - The base Horizon url for Adjutant to use when producing links to Horizon. horizon_url: http://localhost/ - # Integer - # The default token expiry time for Task tokens. + # Integer - The default token expiry time for Task tokens. default_token_expiry: 86400 task_defaults: emails: initial: - # String - # Default email subject for this stage + # String - Default email subject for this stage subject: Task Confirmation - # String - # Default from email for this stage + # String - Default from email for this stage from: bounce+%(task_uuid)s@example.com - # String - # Default reply-to email for this stage + # String - Default reply-to email for this stage reply: no-reply@example.com - # String - # Default email template for this stage + # String - Default email template for this stage template: initial.txt - # String - # Default email html template for this stage + # String - Default email html template for this stage # html_template: token: - # String - # Default email subject for this stage + # String - Default email subject for this stage subject: Task Token - # String - # Default from email for this stage + # String - Default from email for this stage from: bounce+%(task_uuid)s@example.com - # String - # Default reply-to email for this stage + # String - Default reply-to email for this stage reply: no-reply@example.com - # String - # Default email template for this stage + # String - Default email template for this stage template: token.txt - # String - # Default email html template for this stage + # String - Default email html template for this stage # html_template: completed: - # String - # Default email subject for this stage + # String - Default email subject for this stage subject: Task Completed - # String - # Default from email for this stage + # String - Default from email for this stage from: bounce+%(task_uuid)s@example.com - # String - # Default reply-to email for this stage + # String - Default reply-to email for this stage reply: no-reply@example.com - # String - # Default email template for this stage + # String - Default email template for this stage template: completed.txt - # String - # Default email html template for this stage + # String - Default email html template for this stage # html_template: notifications: - # List - # Handlers to use for standard notifications. + # List - Handlers to use for standard notifications. standard_handlers: - EmailNotification - # List - # Handlers to use for error notifications. + # List - Handlers to use for error notifications. error_handlers: - EmailNotification - # Dict - # Settings for standard notification handlers. + # Dict - Settings for standard notification handlers. # standard_handler_config: - # Dict - # Settings for error notification handlers. + # Dict - Settings for error notification handlers. # error_handler_config: - # List - # Error types which are safe to acknowledge automatically. + # List - Error types which are safe to acknowledge automatically. safe_errors: - SMTPException action_defaults: NewProjectWithUserAction: - # List - # Roles to be given on project for the user. + # List - Roles to be given on project for the user. default_roles: - member - project_admin NewProjectAction: - # List - # Roles to be given on project to the creating user. + # List - Roles to be given on project to the creating user. default_roles: - member - project_admin AddDefaultUsersToProjectAction: - # List - # Users which this action should add to the project. + # List - Users which this action should add to the project. # default_users: - # List - # Roles which those users should get. + # List - Roles which those users should get. # default_roles: NewDefaultNetworkAction: - region_defaults: - # String - # Name to be given to the default network. - network_name: default_network - # String - # Name to be given to the default subnet. - subnet_name: default_subnet - # String - # Name to be given to the default router. - router_name: default_router - # String - # ID of the public network. - # public_network: - # String - # CIDR for the default subnet. - # subnet_cidr: - # List - # DNS nameservers for the subnet. - # dns_nameservers: - # Dict - # Specific per region config for default network. See 'region_defaults'. + # Dict - Specific per region config for default network. See 'region_defaults'. # regions: + region_defaults: + # String - Name to be given to the default network. + network_name: default_network + # String - Name to be given to the default subnet. + subnet_name: default_subnet + # String - Name to be given to the default router. + router_name: default_router + # String - ID of the public network. + # public_network: + # String - CIDR for the default subnet. + # subnet_cidr: + # List - DNS nameservers for the subnet. + # dns_nameservers: NewProjectDefaultNetworkAction: - region_defaults: - # String - # Name to be given to the default network. - network_name: default_network - # String - # Name to be given to the default subnet. - subnet_name: default_subnet - # String - # Name to be given to the default router. - router_name: default_router - # String - # ID of the public network. - # public_network: - # String - # CIDR for the default subnet. - # subnet_cidr: - # List - # DNS nameservers for the subnet. - # dns_nameservers: - # Dict - # Specific per region config for default network. See 'region_defaults'. + # Dict - Specific per region config for default network. See 'region_defaults'. # regions: + region_defaults: + # String - Name to be given to the default network. + network_name: default_network + # String - Name to be given to the default subnet. + subnet_name: default_subnet + # String - Name to be given to the default router. + router_name: default_router + # String - ID of the public network. + # public_network: + # String - CIDR for the default subnet. + # subnet_cidr: + # List - DNS nameservers for the subnet. + # dns_nameservers: SetProjectQuotaAction: - # Float - # Precentage different allowed when matching quota sizes. + # Float - Precentage different allowed when matching quota sizes. size_difference_threshold: 0.1 - # Integer - # The allowed number of days between auto approved quota changes. + # Integer - The allowed number of days between auto approved quota changes. days_between_autoapprove: 30 - # Dict - # Which quota size to use for which region. + # Dict - Which quota size to use for which region. region_sizes: RegionOne: small UpdateProjectQuotasAction: - # Float - # Precentage different allowed when matching quota sizes. + # Float - Precentage different allowed when matching quota sizes. size_difference_threshold: 0.1 - # Integer - # The allowed number of days between auto approved quota changes. + # Integer - The allowed number of days between auto approved quota changes. days_between_autoapprove: 30 ResetUserPasswordAction: - # List - # Users with these roles cannot reset their passwords. + # List - Users with these roles cannot reset their passwords. blacklisted_roles: - admin SendAdditionalEmailAction: prepare: - # String - # Email subject for this stage. + # String - Email subject for this stage. subject: Openstack Email Notification - # String - # From email for this stage. + # String - From email for this stage. from: bounce+%(task_uuid)s@example.com - # String - # Reply-to email for this stage. + # String - Reply-to email for this stage. reply: no-reply@example.com - # String - # Email template for this stage. No template will cause the email not to send. + # String - Email template for this stage. No template will cause the email not to send. # template: - # String - # Email html template for this stage. No template will cause the email not to send. + # String - Email html template for this stage. No template will cause the email not to send. # html_template: - # Boolean - # Email the user who started the task. - email_current_user: False - # Boolean - # Send to an email set in the task cache. - email_task_cache: False - # List - # Send emails to the given roles on the project. + # Boolean - Email the user who started the task. + email_current_user: false + # Boolean - Send to an email set in the task cache. + email_task_cache: false + # List - Send emails to the given roles on the project. # email_roles: - # List - # Send emails to an arbitrary admin emails + # List - Send emails to an arbitrary admin emails # email_additional_addresses: approve: - # String - # Email subject for this stage. + # String - Email subject for this stage. subject: Openstack Email Notification - # String - # From email for this stage. + # String - From email for this stage. from: bounce+%(task_uuid)s@example.com - # String - # Reply-to email for this stage. + # String - Reply-to email for this stage. reply: no-reply@example.com - # String - # Email template for this stage. No template will cause the email not to send. + # String - Email template for this stage. No template will cause the email not to send. # template: - # String - # Email html template for this stage. No template will cause the email not to send. + # String - Email html template for this stage. No template will cause the email not to send. # html_template: - # Boolean - # Email the user who started the task. - email_current_user: False - # Boolean - # Send to an email set in the task cache. - email_task_cache: False - # List - # Send emails to the given roles on the project. + # Boolean - Email the user who started the task. + email_current_user: false + # Boolean - Send to an email set in the task cache. + email_task_cache: false + # List - Send emails to the given roles on the project. # email_roles: - # List - # Send emails to an arbitrary admin emails + # List - Send emails to an arbitrary admin emails # email_additional_addresses: submit: - # String - # Email subject for this stage. + # String - Email subject for this stage. subject: Openstack Email Notification - # String - # From email for this stage. + # String - From email for this stage. from: bounce+%(task_uuid)s@example.com - # String - # Reply-to email for this stage. + # String - Reply-to email for this stage. reply: no-reply@example.com - # String - # Email template for this stage. No template will cause the email not to send. + # String - Email template for this stage. No template will cause the email not to send. # template: - # String - # Email html template for this stage. No template will cause the email not to send. + # String - Email html template for this stage. No template will cause the email not to send. # html_template: - # Boolean - # Email the user who started the task. - email_current_user: False - # Boolean - # Send to an email set in the task cache. - email_task_cache: False - # List - # Send emails to the given roles on the project. + # Boolean - Email the user who started the task. + email_current_user: false + # Boolean - Send to an email set in the task cache. + email_task_cache: false + # List - Send emails to the given roles on the project. # email_roles: - # List - # Send emails to an arbitrary admin emails + # List - Send emails to an arbitrary admin emails # email_additional_addresses: tasks: create_project_and_user: - # Boolean - # Override if this task allows auto_approval. Otherwise uses task default. - allow_auto_approve: True - # List - # Additional actions to be run as part of the task after default actions. + # Boolean - Override if this task allows auto_approval. Otherwise uses task default. + allow_auto_approve: true + # List - Additional actions to be run as part of the task after default actions. # additional_actions: - # Integer - # Override for the task token expiry. Otherwise uses task default. + # Integer - Override for the task token expiry. Otherwise uses task default. # token_expiry: - # Dict - # Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. + # Dict - Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. actions: SomeCustomAction: some_action_setting: - # Dict - # Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. + # Dict - Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. emails: completed: subject: signup completed @@ -457,78 +338,66 @@ workflow: token: subject: signup approved template: create_project_and_user_token.txt - # Dict - # Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. + # Dict - Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. notifications: error_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com error_handlers: - - EmailNotification + - EmailNotification standard_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com standard_handlers: - - EmailNotification + - EmailNotification edit_user_roles: - # Boolean - # Override if this task allows auto_approval. Otherwise uses task default. - allow_auto_approve: True - # List - # Additional actions to be run as part of the task after default actions. + # Boolean - Override if this task allows auto_approval. Otherwise uses task default. + allow_auto_approve: true + # List - Additional actions to be run as part of the task after default actions. # additional_actions: - # Integer - # Override for the task token expiry. Otherwise uses task default. + # Integer - Override for the task token expiry. Otherwise uses task default. # token_expiry: - # Dict - # Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. + # Dict - Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. actions: SomeCustomAction: some_action_setting: - # Dict - # Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. + # Dict - Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. emails: completed: null initial: null token: null - # Dict - # Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. + # Dict - Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. notifications: error_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com error_handlers: - - EmailNotification + - EmailNotification standard_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com standard_handlers: - - EmailNotification + - EmailNotification invite_user_to_project: - # Boolean - # Override if this task allows auto_approval. Otherwise uses task default. - allow_auto_approve: True - # List - # Additional actions to be run as part of the task after default actions. + # Boolean - Override if this task allows auto_approval. Otherwise uses task default. + allow_auto_approve: true + # List - Additional actions to be run as part of the task after default actions. # additional_actions: - # Integer - # Override for the task token expiry. Otherwise uses task default. + # Integer - Override for the task token expiry. Otherwise uses task default. # token_expiry: - # Dict - # Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. + # Dict - Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. actions: SomeCustomAction: some_action_setting: - # Dict - # Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. + # Dict - Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. emails: completed: subject: invite_user_to_project @@ -537,40 +406,34 @@ workflow: token: subject: invite_user_to_project template: invite_user_to_project_token.txt - # Dict - # Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. + # Dict - Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. notifications: error_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com error_handlers: - - EmailNotification + - EmailNotification standard_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com standard_handlers: - - EmailNotification + - EmailNotification reset_user_password: - # Boolean - # Override if this task allows auto_approval. Otherwise uses task default. - allow_auto_approve: True - # List - # Additional actions to be run as part of the task after default actions. + # Boolean - Override if this task allows auto_approval. Otherwise uses task default. + allow_auto_approve: true + # List - Additional actions to be run as part of the task after default actions. # additional_actions: - # Integer - # Override for the task token expiry. Otherwise uses task default. + # Integer - Override for the task token expiry. Otherwise uses task default. # token_expiry: - # Dict - # Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. + # Dict - Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. actions: SomeCustomAction: some_action_setting: - # Dict - # Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. + # Dict - Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. emails: completed: subject: Password Reset for OpenStack @@ -579,44 +442,38 @@ workflow: token: subject: Password Reset for OpenStack template: reset_user_password_token.txt - # Dict - # Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. + # Dict - Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. notifications: error_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com error_handlers: - - EmailNotification + - EmailNotification standard_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com standard_handlers: - - EmailNotification + - EmailNotification update_user_email: - # Boolean - # Override if this task allows auto_approval. Otherwise uses task default. - allow_auto_approve: True - # List - # Additional actions to be run as part of the task after default actions. + # Boolean - Override if this task allows auto_approval. Otherwise uses task default. + allow_auto_approve: true + # List - Additional actions to be run as part of the task after default actions. additional_actions: - SendAdditionalEmailAction - # Integer - # Override for the task token expiry. Otherwise uses task default. + # Integer - Override for the task token expiry. Otherwise uses task default. # token_expiry: - # Dict - # Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. + # Dict - Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. actions: SendAdditionalEmailAction: initial: email_current_user: true subject: OpenStack Email Update Requested template: update_user_email_started.txt - # Dict - # Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. + # Dict - Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. emails: completed: subject: Email Update Complete @@ -625,67 +482,59 @@ workflow: token: subject: update_user_email_token template: update_user_email_token.txt - # Dict - # Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. + # Dict - Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. notifications: error_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com error_handlers: - - EmailNotification + - EmailNotification standard_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com standard_handlers: - - EmailNotification + - EmailNotification update_quota: - # Boolean - # Override if this task allows auto_approval. Otherwise uses task default. - allow_auto_approve: True - # List - # Additional actions to be run as part of the task after default actions. + # Boolean - Override if this task allows auto_approval. Otherwise uses task default. + allow_auto_approve: true + # List - Additional actions to be run as part of the task after default actions. # additional_actions: - # Integer - # Override for the task token expiry. Otherwise uses task default. + # Integer - Override for the task token expiry. Otherwise uses task default. # token_expiry: - # Dict - # Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. + # Dict - Action config overrides over the action defaults. See 'adjutant.workflow.action_defaults'. actions: SomeCustomAction: some_action_setting: - # Dict - # Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. + # Dict - Email config overrides for this task over task defaults.See 'adjutant.workflow.emails'. emails: completed: subject: signup completed template: create_project_and_user_completed.txt initial: null token: null - # Dict - # Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. + # Dict - Notification config overrides for this task over task defaults.See 'adjutant.workflow.notifications'. notifications: error_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com error_handlers: - - EmailNotification + - EmailNotification standard_handler_config: EmailNotification: emails: - - example@example.com + - example@example.com reply: no-reply@example.com standard_handlers: - - EmailNotification + - EmailNotification quota: - # Dict - # A definition of the quota size groups that Adjutant should use. + # Dict - A definition of the quota size groups that Adjutant should use. sizes: large: cinder: @@ -780,17 +629,15 @@ quota: load_balancer: 1 member: 2 pool: 1 - # List - # An ascending list of all the quota size names, so that Adjutant knows their relative sizes/order. + # List - An ascending list of all the quota size names, so that Adjutant knows their relative sizes/order. sizes_ascending: - small - medium - large - # Dict - # A per region definition of what services Adjutant should manage quotas for. '*' means all or default region. + # Dict - A per region definition of what services Adjutant should manage quotas for. '*' means all or default region. services: '*': - - cinder - - neutron - - nova + - cinder + - neutron + - nova diff --git a/releasenotes/notes/toml-d8fba261f61313bf.yaml b/releasenotes/notes/toml-d8fba261f61313bf.yaml new file mode 100644 index 0000000..53176f4 --- /dev/null +++ b/releasenotes/notes/toml-d8fba261f61313bf.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Adjutant now optionally supports toml as a config file format, + although yaml is still considered the default. Both can now be + exported as example configs. diff --git a/requirements.txt b/requirements.txt index cfc10da..f39647c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,6 @@ python-keystoneclient>=3.19.0 python-neutronclient>=6.12.0 python-novaclient>=14.0.0 python-octaviaclient>=1.8.0 -PyYAML>=5.1 six>=1.12.0 -confspirator>=0.1.6 +confspirator>=0.2.2 mysqlclient>=1.4.6 \ No newline at end of file