Skip to content

Commit 51050e2

Browse files
mnasiadkaAlex-Welsh
authored andcommitted
Switch to pypi version of j2lint and fix linting errors
Since ipwrap filter is getting moved another time inside ansible code - let's switch to j2lint that is actively maintained and it's rules will help in readability of jinja2 templates Change-Id: I6762b691b927de31fa1abd83c4c14e87226fe5e2 Signed-off-by: Michal Nasiadka <[email protected]>
1 parent dff941f commit 51050e2

File tree

68 files changed

+643
-714
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+643
-714
lines changed

ansible/roles/ceilometer/templates/pipeline.yaml.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# j2lint: disable=jinja-variable-lower-case #}
12
---
23
sources:
34
- name: meter_source
@@ -12,5 +13,5 @@ sinks:
1213
- gnocchi://
1314
{% endif %}
1415
{% if enable_ceilometer_prometheus_pushgateway | bool %}
15-
- prometheus://{{ ceilometer_prometheus_pushgateway_host }}:{{ ceilometer_prometheus_pushgateway_port }}/metrics/job/openstack-telemetry{% if ceilometer_prometheus_pushgateway_options %}/?{{ (ceilometer_prometheus_pushgateway_options | dict2items | rejectattr("value", "equalto", None) | list | items2dict).items() | map("join", "=") | join("&")}}{% endif %}
16+
- prometheus://{{ ceilometer_prometheus_pushgateway_host }}:{{ ceilometer_prometheus_pushgateway_port }}/metrics/job/openstack-telemetry{% if ceilometer_prometheus_pushgateway_options %}/?{{ (ceilometer_prometheus_pushgateway_options | dict2items | rejectattr("value", "equalto", None) | list | items2dict).items() | map("join", "=") | join("&") }}{% endif %}
1617
{% endif %}

ansible/roles/cinder/templates/cinder-volume.json.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"owner": "cinder",
1414
"perm": "0600",
1515
"optional": {{ (not cinder_backend_huawei | bool) | string | lower }}
16-
},{% endfor%}{% endif %}{% if cinder_backend_ceph | bool %}
16+
},{% endfor %}{% endif %}{% if cinder_backend_ceph | bool %}
1717
{
1818
"source": "{{ container_config_directory }}/ceph",
1919
"dest": "/etc/ceph",

ansible/roles/cinder/templates/cinder-wsgi.conf.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{% if cinder_enable_tls_backend | bool %}
2-
{% if kolla_base_distro in ['centos', 'rocky'] %}
2+
{% if kolla_base_distro in ['centos', 'rocky'] %}
33
LoadModule ssl_module /usr/lib64/httpd/modules/mod_ssl.so
4-
{% else %}
4+
{% else %}
55
LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so
6-
{% endif %}
6+
{% endif %}
77
{% endif %}
88
Listen {{ api_interface_address | put_address_in_context('url') }}:{{ cinder_api_listen_port }}
99

ansible/roles/cinder/templates/cinder.conf.j2

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ cluster = {{ cinder_cluster_name }}
2525
{% endif %}
2626

2727
{% if cinder_enabled_backends %}
28-
{% if service_name == 'cinder-volume' %}
29-
enabled_backends = {{ cinder_enabled_backends|map(attribute='name')|join(',') }}
30-
{% endif %}
28+
{% if service_name == 'cinder-volume' %}
29+
enabled_backends = {{ cinder_enabled_backends | map(attribute='name') | join(',') }}
30+
{% endif %}
3131
{% endif %}
3232

3333
{% if service_name == "cinder-backup" and enable_cinder_backup | bool %}
34-
{% if cinder_backup_driver == "ceph" %}
34+
{% if cinder_backup_driver == "ceph" %}
3535
backup_driver = cinder.backup.drivers.ceph.CephBackupDriver
3636
backup_ceph_conf = /etc/ceph/{{ cinder_backup_ceph_backend['cluster'] }}.conf
3737
backup_ceph_user = {{ cinder_backup_ceph_backend['user'] }}
@@ -40,19 +40,19 @@ backup_ceph_pool = {{ cinder_backup_ceph_backend['pool'] }}
4040
backup_ceph_stripe_unit = 0
4141
backup_ceph_stripe_count = 0
4242
restore_discard_excess_bytes = true
43-
{% elif cinder_backup_driver == "nfs" %}
43+
{% elif cinder_backup_driver == "nfs" %}
4444
backup_driver = cinder.backup.drivers.nfs.NFSBackupDriver
4545
backup_mount_options = {{ cinder_backup_mount_options_nfs }}
4646
backup_mount_point_base = /var/lib/cinder/backup
4747
backup_share = {{ cinder_backup_share }}
4848
backup_file_size = 327680000
49-
{% elif cinder_backup_driver == "s3" %}
49+
{% elif cinder_backup_driver == "s3" %}
5050
backup_driver = cinder.backup.drivers.s3.S3BackupDriver
5151
backup_s3_endpoint_url = {{ cinder_backup_s3_url }}
5252
backup_s3_store_bucket = {{ cinder_backup_s3_bucket }}
5353
backup_s3_store_access_key = {{ cinder_backup_s3_access_key }}
5454
backup_s3_store_secret_key = {{ cinder_backup_s3_secret_key }}
55-
{% endif %}
55+
{% endif %}
5656
{% endif %}
5757

5858
api_paste_config = /etc/cinder/api-paste.ini
@@ -148,8 +148,8 @@ target_protocol = iscsi
148148
{% endif %}
149149

150150
{% if cinder_backend_ceph | bool %}
151-
{% if service_name == 'cinder-volume' %}
152-
{% for backend in cinder_ceph_backends %}
151+
{% if service_name == 'cinder-volume' %}
152+
{% for backend in cinder_ceph_backends %}
153153
[{{ backend.name }}]
154154
volume_driver = cinder.volume.drivers.rbd.RBDDriver
155155
volume_backend_name = {{ backend.backend_name | default(backend.name) }}
@@ -161,11 +161,11 @@ rbd_cluster_name = {{ backend.cluster }}
161161
rbd_keyring_conf = /etc/ceph/{{ backend.cluster }}.client.{{ backend.user }}.keyring
162162
rbd_secret_uuid = {{ cinder_rbd_secret_uuid }}
163163
report_discard_supported = true
164-
{% if backend.availability_zone is defined %}
164+
{% if backend.availability_zone is defined %}
165165
backend_availability_zone = {{ backend.availability_zone }}
166-
{% endif %}
167-
{% endfor %}
168-
{% endif %}
166+
{% endif %}
167+
{% endfor %}
168+
{% endif %}
169169
{% endif %}
170170

171171
{% if enable_cinder_backend_nfs | bool %}
@@ -225,7 +225,7 @@ lightos_api_address = {{ lightbits_target_ips }}
225225
lightos_api_port = {{ lightbits_api_port }}
226226
lightos_default_num_replicas = {{ lightbits_default_num_replicas }}
227227
lightos_skip_ssl_verify = {{ lightbits_skip_ssl_verify | bool }}
228-
lightos_jwt = {{ lightbits_JWT }}
228+
lightos_jwt = {{ lightbits_jwt }}
229229
{% endif %}
230230

231231
[privsep_entrypoint]

ansible/roles/cloudkitty/templates/cloudkitty.conf.j2

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ prometheus_url = {{ cloudkitty_prometheus_url }}
7979
prometheus_user = admin
8080
prometheus_password = {{ prometheus_password }}
8181

82-
{% if cloudkitty_prometheus_cafile is defined %}
82+
{% if cloudkitty_prometheus_cafile is defined %}
8383
cafile = {{ cloudkitty_prometheus_cafile }}
84-
{% endif %}
84+
{% endif %}
8585

8686
insecure = {{ cloudkitty_prometheus_insecure_connections }}
8787
{% endif %}
@@ -105,9 +105,9 @@ prometheus_url = {{ cloudkitty_prometheus_url }}
105105
prometheus_user = admin
106106
prometheus_password = {{ prometheus_password }}
107107

108-
{% if cloudkitty_prometheus_cafile is defined %}
108+
{% if cloudkitty_prometheus_cafile is defined %}
109109
cafile = {{ cloudkitty_prometheus_cafile }}
110-
{% endif %}
110+
{% endif %}
111111

112112
insecure = {{ cloudkitty_prometheus_insecure_connections }}
113113
{% endif %}
@@ -134,21 +134,21 @@ database = {{ cloudkitty_influxdb_name }}
134134
host = {{ influxdb_address }}
135135
port = {{ influxdb_http_port }}
136136

137-
{% if cloudkitty_influxdb_retention_policy is defined %}
137+
{% if cloudkitty_influxdb_retention_policy is defined %}
138138
retention_policy = {{ cloudkitty_influxdb_retention_policy }}
139-
{% endif %}
139+
{% endif %}
140140

141-
{% if cloudkitty_influxdb_use_ssl is defined %}
141+
{% if cloudkitty_influxdb_use_ssl is defined %}
142142
use_ssl = {{ cloudkitty_influxdb_use_ssl }}
143-
{% endif %}
143+
{% endif %}
144144

145-
{% if cloudkitty_influxdb_insecure_connections is defined %}
145+
{% if cloudkitty_influxdb_insecure_connections is defined %}
146146
insecure = {{ cloudkitty_influxdb_insecure_connections }}
147-
{% endif %}
147+
{% endif %}
148148

149-
{% if cloudkitty_influxdb_cafile is defined %}
149+
{% if cloudkitty_influxdb_cafile is defined %}
150150
cafile = {{ cloudkitty_influxdb_cafile }}
151-
{% endif %}
151+
{% endif %}
152152

153153
{% endif %}
154154

@@ -158,9 +158,9 @@ host = {{ cloudkitty_elasticsearch_url }}
158158
index_name = {{ cloudkitty_elasticsearch_index_name }}
159159
insecure = {{ cloudkitty_elasticsearch_insecure_connections }}
160160

161-
{% if cloudkitty_elasticsearch_cafile | length > 0 %}
161+
{% if cloudkitty_elasticsearch_cafile | length > 0 %}
162162
cafile = {{ cloudkitty_elasticsearch_cafile }}
163-
{% endif %}
163+
{% endif %}
164164
{% endif %}
165165

166166
{% if cloudkitty_storage_backend == 'opensearch' %}
@@ -169,7 +169,7 @@ host = {{ cloudkitty_opensearch_url }}
169169
index_name = {{ cloudkitty_opensearch_index_name }}
170170
insecure = {{ cloudkitty_opensearch_insecure_connections }}
171171

172-
{% if cloudkitty_opensearch_cafile | length > 0 %}
172+
{% if cloudkitty_opensearch_cafile | length > 0 %}
173173
cafile = {{ cloudkitty_opensearch_cafile }}
174-
{% endif %}
174+
{% endif %}
175175
{% endif %}

ansible/roles/cron/templates/cron-logrotate-global.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ maxsize {{ cron_logrotate_log_maxsize }}
1919
su root kolla
2020

2121
{% for service in cron_logrotate_enabled_services %}
22-
{% include "cron-logrotate-" ~ service ~ ".conf.j2" %}
22+
{% include "cron-logrotate-" ~ service ~ ".conf.j2" %}
2323

2424
{% endfor %}

ansible/roles/designate/templates/pools.yaml.j2

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,61 @@
44
description: Default BIND9 Pool
55
attributes: {}
66
ns_records:
7-
{% if designate_ns_record is string %}
7+
{% if designate_ns_record is string %}
88
- hostname: {{ designate_ns_record }}.
99
priority: 1
10-
{% else %}
11-
{% for host in designate_ns_record %}
10+
{% else %}
11+
{% for host in designate_ns_record %}
1212
- hostname: {{ host }}.
1313
priority: 1
14-
{% endfor %}
15-
{% endif %}
14+
{% endfor %}
15+
{% endif %}
1616
nameservers:
17-
{% if designate_backend == 'bind9' %}
18-
{% for host in groups['designate-backend-bind9'] %}
17+
{% if designate_backend == 'bind9' %}
18+
{% for host in groups['designate-backend-bind9'] %}
1919
- host: {{ 'api' | kolla_address(host) }}
2020
port: {{ designate_bind_port }}
21-
{% endfor %}
22-
{% elif designate_backend_external == 'bind9' %}
23-
{% for host in designate_backend_external_bind9_nameservers.replace(" ", "").split(',') %}
21+
{% endfor %}
22+
{% elif designate_backend_external == 'bind9' %}
23+
{% for host in designate_backend_external_bind9_nameservers.replace(" ", "").split(',') %}
2424
- host: {{ host }}
2525
port: {{ designate_bind_port }}
26-
{% endfor %}
27-
{% endif %}
26+
{% endfor %}
27+
{% endif %}
2828
targets:
29-
{% if designate_backend == 'bind9' %}
30-
{% for bind_host in groups['designate-backend-bind9'] %}
29+
{% if designate_backend == 'bind9' %}
30+
{% for bind_host in groups['designate-backend-bind9'] %}
3131
- type: bind9
3232
description: BIND9 Server {{ 'api' | kolla_address(bind_host) }}
3333
masters:
34-
{% for mdns_host in groups['designate-mdns'] %}
34+
{% for mdns_host in groups['designate-mdns'] %}
3535
- host: {{ 'dns' | kolla_address(mdns_host) }}
3636
port: {{ designate_mdns_port }}
37-
{% endfor %}
37+
{% endfor %}
3838
options:
3939
host: {{ 'api' | kolla_address(bind_host) }}
4040
port: {{ designate_bind_port }}
4141
rndc_host: {{ 'api' | kolla_address(bind_host) }}
4242
rndc_port: {{ designate_rndc_port }}
4343
rndc_key_file: /etc/designate/rndc.key
44-
{% endfor %}
45-
{% elif designate_backend_external == 'bind9' %}
46-
{% for bind_host in designate_backend_external_bind9_nameservers.replace(" ", "").split(',') %}
44+
{% endfor %}
45+
{% elif designate_backend_external == 'bind9' %}
46+
{% for bind_host in designate_backend_external_bind9_nameservers.replace(" ", "").split(',') %}
4747
- type: bind9
4848
description: BIND9 Server {{ bind_host }}
4949
masters:
50-
{% for mdns_host in groups['designate-mdns'] %}
50+
{% for mdns_host in groups['designate-mdns'] %}
5151
- host: {{ 'dns' | kolla_address(mdns_host) }}
5252
port: {{ designate_mdns_port }}
53-
{% endfor %}
53+
{% endfor %}
5454
options:
5555
host: {{ bind_host }}
5656
port: {{ designate_bind_port }}
5757
rndc_host: {{ bind_host }}
5858
rndc_port: {{ designate_rndc_port }}
5959
rndc_key_file: /etc/designate/rndc.key
60-
{% endfor %}
61-
{% endif %}
60+
{% endfor %}
61+
{% endif %}
6262
{% elif designate_backend == 'infoblox' %}
6363
- name: infoblox
6464
id: {{ designate_pool_id }}
@@ -69,23 +69,23 @@
6969
- hostname: {{ designate_ns_record }}.
7070
priority: 1
7171
nameservers:
72-
{% for host in designate_backend_infoblox_nameservers.replace(" ", "").split(',') %}
72+
{% for host in designate_backend_infoblox_nameservers.replace(" ", "").split(',') %}
7373
- host: {{ host }}
7474
port: {{ designate_bind_port }}
75-
{% endfor %}
75+
{% endfor %}
7676
also_notifies:
77-
{% for host in designate_backend_infoblox_nameservers.replace(" ", "").split(',') %}
77+
{% for host in designate_backend_infoblox_nameservers.replace(" ", "").split(',') %}
7878
- host: {{ host }}
7979
port: {{ designate_bind_port }}
80-
{% endfor %}
80+
{% endfor %}
8181
targets:
8282
- type: infoblox
8383
description: Default Infoblox Pool
8484
masters:
85-
{% for mdns_host in groups['designate-mdns'] %}
85+
{% for mdns_host in groups['designate-mdns'] %}
8686
- host: {{ 'dns' | kolla_address(mdns_host) }}
8787
port: {{ designate_mdns_port }}
88-
{% endfor %}
88+
{% endfor %}
8989
options:
9090
host: {{ designate_infoblox_host }}
9191
port: 53

ansible/roles/fluentd/templates/conf/input/00-global.conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#jinja2: trim_blocks: False
2-
{% if fluentd_enabled_input_openstack_services | length > 0 -%}
2+
{% if fluentd_enabled_input_openstack_services | length > 0 %}
33
<source>
44
@type tail
55
path {% for service in fluentd_enabled_input_openstack_services %}/var/log/kolla/{{ service }}/*.log{% if not loop.last %},{% endif %}{% endfor %}
@@ -23,4 +23,4 @@
2323
time_format %F %T.%L
2424
</parse>
2525
</source>
26-
{%- endif %}
26+
{% endif %}

ansible/roles/fluentd/templates/conf/input/10-openvswitch.conf.j2

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</source>
3030

3131
{% if enable_ovn | bool %}
32-
{% if inventory_hostname in groups.get('ovn-controller', []) %}
32+
{% if inventory_hostname in groups.get('ovn-controller', []) %}
3333
<source>
3434
@type tail
3535
path /var/log/kolla/openvswitch/ovn-controller.log
@@ -44,9 +44,9 @@
4444
time_format %FT%T.%L
4545
</parse>
4646
</source>
47-
{% endif %}
48-
{% for ovn_service in ['ovn-nb-db', 'ovn-northd', 'ovn-sb-db'] %}
49-
{% if inventory_hostname in groups.get(ovn_service, []) %}
47+
{% endif %}
48+
{% for ovn_service in ['ovn-nb-db', 'ovn-northd', 'ovn-sb-db'] %}
49+
{% if inventory_hostname in groups.get(ovn_service, []) %}
5050
<source>
5151
@type tail
5252
path /var/log/kolla/openvswitch/{{ ovn_service }}.log
@@ -61,10 +61,10 @@
6161
time_format %FT%T.%L
6262
</parse>
6363
</source>
64-
{% endif %}
65-
{% endfor %}
66-
{% for relay_id in range(1, ovn_sb_db_relay_count | int + 1) %}
67-
{% if inventory_hostname in groups.get('ovn-sb-db-relay', []) %}
64+
{% endif %}
65+
{% endfor %}
66+
{% for relay_id in range(1, ovn_sb_db_relay_count | int + 1) %}
67+
{% if inventory_hostname in groups.get('ovn-sb-db-relay', []) %}
6868
<source>
6969
@type tail
7070
path /var/log/kolla/openvswitch/ovn-sb-relay-{{ relay_id }}.log
@@ -79,6 +79,6 @@
7979
time_format %FT%T.%L
8080
</parse>
8181
</source>
82-
{% endif %}
83-
{% endfor %}
82+
{% endif %}
83+
{% endfor %}
8484
{% endif %}

ansible/roles/fluentd/templates/conf/input/13-uwsgi.conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#jinja2: trim_blocks: False
2-
{% if fluentd_enabled_input_openstack_services | length > 0 -%}
2+
{% if fluentd_enabled_input_openstack_services | length > 0 %}
33
<source>
44
@type tail
55
path {% for service in fluentd_enabled_input_openstack_services %}/var/log/kolla/{{ service }}/*-uwsgi.log{% if not loop.last %},{% endif %}{% endfor %}
@@ -15,4 +15,4 @@
1515
time_format %c
1616
</parse>
1717
</source>
18-
{%- endif %}
18+
{% endif %}

0 commit comments

Comments
 (0)