Skip to content

Commit

Permalink
Config property keys not always in quotes to_json
Browse files Browse the repository at this point in the history
the keys for extra-config-options should not always be in quotes. this
happens because every line is filtered with to_json. this will only
apply if the key contains a dot.
  • Loading branch information
crazychatting committed Jun 7, 2022
1 parent b7e1bfb commit 18488d9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tasks/line-config-runner-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@
line: '{{ " " * (section.split(".")|length -1) }}[{{ section }}]'

- name: "(Windows) {{ line_name_prefix }} Modify existing line"
win_lineinfile:
path: "{{ temp_runner_config.path }}"
insertafter: '\s+\[{{ section | regex_escape }}\]'
regexp: '^(\s*)({{ line | regex_escape }}|{{ line | regex_escape }}) =.*'
line: '{{ " " * (section.split(".")|length) }}{{ line }} = {{ gitlab_runner.extra_configs[section][line] | to_json }}'
register: modified_config_line
when: "not '.' in line"

- name: "(Windows) {{ line_name_prefix }} Modify existing line to_json"
win_lineinfile:
path: "{{ temp_runner_config.path }}"
insertafter: '\s+\[{{ section | regex_escape }}\]'
regexp: '^(\s*)({{ line | to_json | regex_escape }}|{{ line | regex_escape }}) =.*'
line: '{{ " " * (section.split(".")|length) }}{{ line | to_json }} = {{ gitlab_runner.extra_configs[section][line] | to_json }}'
register: modified_config_line
when: "'.' in line"
10 changes: 10 additions & 0 deletions tasks/line-config-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@
line: '{{ " " * (section.split(".")|length -1) }}[{{ section }}]'

- name: "{{ line_name_prefix }} Modify existing line"
lineinfile:
path: "{{ temp_runner_config.path }}"
insertafter: '\s+\[{{ section | regex_escape }}\]'
regexp: '^(\s*)({{ line | regex_escape }}|{{ line | regex_escape }}) ='
line: '{{ " " * (section.split(".")|length) }}{{ line }} = {{ gitlab_runner.extra_configs[section][line] | to_json }}'
register: modified_config_line
when: "not '.' in line"

- name: "{{ line_name_prefix }} Modify existing line to_json"
lineinfile:
path: "{{ temp_runner_config.path }}"
insertafter: '\s+\[{{ section | regex_escape }}\]'
regexp: '^(\s*)({{ line | to_json | regex_escape }}|{{ line | regex_escape }}) ='
line: '{{ " " * (section.split(".")|length) }}{{ line | to_json }} = {{ gitlab_runner.extra_configs[section][line] | to_json }}'
register: modified_config_line
when: "'.' in line"

0 comments on commit 18488d9

Please sign in to comment.