From 9fc0ef7b693f24b4c00ed1da59b8880885faaba7 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 16 Feb 2018 11:38:27 +0100 Subject: [PATCH] Cosmetics: cleanup .get('var', None) syntax => can be written: .get('var') --- aptly/meta/sphinx.yml | 6 +++--- aptly/server/init.sls | 8 ++++---- aptly/server/mirrors.sls | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/aptly/meta/sphinx.yml b/aptly/meta/sphinx.yml index 167efdf..dae9a29 100644 --- a/aptly/meta/sphinx.yml +++ b/aptly/meta/sphinx.yml @@ -17,11 +17,11 @@ doc: gpg: value: keypair_id: {{ server.gpg.keypair_id }} - {%- if server.gpg.get('keyring', None) %} + {%- if server.gpg.get('keyring') %} keyring: {{ server.gpg.keyring }} {%- endif %} - {%- if server.gpg.get('homedir', None) %} - homedir: {{ server.gpg.get('homedir', None) }} + {%- if server.gpg.get('homedir') %} + homedir: {{ server.gpg.get('homedir') }} {%- endif %} {%- endif %} directories: diff --git a/aptly/server/init.sls b/aptly/server/init.sls index c8abb28..d3a7228 100644 --- a/aptly/server/init.sls +++ b/aptly/server/init.sls @@ -162,18 +162,18 @@ gpg_pub_key: import_gpg_pub_key: cmd.run: - - name: gpg --no-tty{% if server.gpg.get('homedir', None) %} --homedir {{ server.gpg.homedir }}{% endif %} --import {{ gpgpubfile }} + - name: gpg --no-tty{% if server.gpg.get('homedir') %} --homedir {{ server.gpg.homedir }}{% endif %} --import {{ gpgpubfile }} - user: {{ server.user.name }} - - unless: gpg --no-tty{% if server.gpg.get('homedir', None) %} --homedir {{ server.gpg.homedir }}{% endif %} --list-keys | grep '{{ server.gpg.keypair_id }}' + - unless: gpg --no-tty{% if server.gpg.get('homedir') %} --homedir {{ server.gpg.homedir }}{% endif %} --list-keys | grep '{{ server.gpg.keypair_id }}' - require: - file: gpg_pub_key - cmd: import_gpg_priv_key import_gpg_priv_key: cmd.run: - - name: gpg --no-tty --allow-secret-key-import{% if server.gpg.get('homedir', None) %} --homedir {{ server.gpg.homedir }}{% endif %} --import {{ gpgprivfile }} + - name: gpg --no-tty --allow-secret-key-import{% if server.gpg.get('homedir') %} --homedir {{ server.gpg.homedir }}{% endif %} --import {{ gpgprivfile }} - user: {{ server.user.name }} - - unless: gpg --no-tty{% if server.gpg.get('homedir', None) %} --homedir {{ server.gpg.homedir }}{% endif %} --list-secret-keys | grep '{{ server.gpg.keypair_id }}' + - unless: gpg --no-tty{% if server.gpg.get('homedir') %} --homedir {{ server.gpg.homedir }}{% endif %} --list-secret-keys | grep '{{ server.gpg.keypair_id }}' - require: - file: aptly_gpg_key_dir - file: gpg_priv_key diff --git a/aptly/server/mirrors.sls b/aptly/server/mirrors.sls index ddf09a8..a994bd1 100644 --- a/aptly/server/mirrors.sls +++ b/aptly/server/mirrors.sls @@ -44,10 +44,10 @@ aptly_mirror_update_cron: gpg_add_keys_{{ mirror_name }}_{{ gpgkey }}: cmd.run: - - name: gpg --no-tty {% if server.gpg.get('keyring', None) %} --no-default-keyring --keyring {{ server.gpg.keyring }} {% endif %}{% if server.gpg.get('homedir', None) %} --homedir {{ server.gpg.homedir }}{% endif %} --keyserver {{ mirror.keyserver|default(server.gpg.keyserver) }} {% if server.gpg.get('http_proxy', None) %} --keyserver-options http-proxy={{ server.gpg.get('http_proxy') }} {% endif %} --recv-keys {{ gpgkey }} + - name: gpg --no-tty {% if server.gpg.get('keyring') %} --no-default-keyring --keyring {{ server.gpg.keyring }} {% endif %}{% if server.gpg.get('homedir') %} --homedir {{ server.gpg.homedir }}{% endif %} --keyserver {{ mirror.keyserver|default(server.gpg.keyserver) }} {% if server.gpg.get('http_proxy') %} --keyserver-options http-proxy={{ server.gpg.get('http_proxy') }} {% endif %} --recv-keys {{ gpgkey }} - user: {{ server.user.name }} - cwd: {{ server.home_dir }} - - unless: gpg --no-tty {% if server.gpg.get('keyring', None) %} --no-default-keyring --keyring {{ server.gpg.keyring }} {% endif %}{% if server.gpg.get('homedir', None) %} --homedir {{ server.gpg.homedir }} {% endif %} {% if server.gpg.get('http_proxy', None) %} --keyserver-options http-proxy={{ server.gpg.get('http_proxy') }} {% endif %} --list-public-keys {{gpgkey}} + - unless: gpg --no-tty {% if server.gpg.get('keyring') %} --no-default-keyring --keyring {{ server.gpg.keyring }} {% endif %}{% if server.gpg.get('homedir') %} --homedir {{ server.gpg.homedir }} {% endif %} {% if server.gpg.get('http_proxy') %} --keyserver-options http-proxy={{ server.gpg.get('http_proxy') }} {% endif %} --list-public-keys {{gpgkey}} {%- if server.secure %} - require: - cmd: import_gpg_priv_key