saltstack-formulas / openssh-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
90 stars 297 forks source link

fix(jinja): omit_ip_address don't work on some platform #188

Closed baby-gnu closed 4 years ago

baby-gnu commented 4 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

It apprears that the

if not (omit_ip_address is sameas true or host in omit_ip_address)

always returns True on older Jinja platforms:

Each part of the or conditional need to be surrounded by parenthesis.

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Before:

       [INFO    ] Executing state file.managed for [/etc/ssh/ssh_known_hosts]
       [DEBUG   ] Returning file list from cache: age=7 cache_time=20 /tmp/kitchen/var/cache/salt/minion/file_lists/roots/base.p
       [DEBUG   ] Returning file list from cache: age=7 cache_time=20 /tmp/kitchen/var/cache/salt/minion/file_lists/roots/base.p
       [DEBUG   ] In saltenv 'base', looking at rel_path 'openssh/files/default/ssh_known_hosts' to resolve 'salt://openssh/files/default/ssh_known_hosts'
       [DEBUG   ] In saltenv 'base', ** considering ** path '/tmp/kitchen/var/cache/salt/minion/files/base/openssh/files/default/ssh_known_hosts' to resolve 'salt://openssh/files/default/ssh_known_hosts'
       [DEBUG   ] Fetching file from saltenv 'base', ** attempting ** 'salt://openssh/files/default/ssh_known_hosts'
       [DEBUG   ] No dest file found
       [INFO    ] Fetching file from saltenv 'base', ** done ** 'openssh/files/default/ssh_known_hosts'
       [DEBUG   ] Jinja search path: ['/tmp/kitchen/var/cache/salt/minion/files/base']
       [INFO    ] Executing command ['dig', '+short', 'cname-to-minion.example.org', 'A'] in directory '/home/kitchen'
       [INFO    ] Executing command ['dig', '+short', 'cname-to-minion.example.org', 'AAAA'] in directory '/home/kitchen'
       [INFO    ] Executing command ['dig', '+short', 'alias.example.org', 'A'] in directory '/home/kitchen'
       [INFO    ] Executing command ['dig', '+short', 'alias.example.org', 'AAAA'] in directory '/home/kitchen'
       [DEBUG   ] LazyLoaded glob_match.match
       [DEBUG   ] LazyLoaded glob_match.match
       [DEBUG   ] LazyLoaded glob_match.match
       [DEBUG   ] LazyLoaded glob_match.match
       [INFO    ] Executing command ['dig', '+short', 'github.com', 'A'] in directory '/home/kitchen'
       [DEBUG   ] stdout: 140.82.118.4
       [INFO    ] Executing command ['dig', '+short', 'github.com', 'AAAA'] in directory '/home/kitchen'
       [INFO    ] Executing command ['dig', '+short', 'gitlab.com', 'A'] in directory '/home/kitchen'
       [DEBUG   ] stdout: 172.65.251.78
       [INFO    ] Executing command ['dig', '+short', 'gitlab.com', 'AAAA'] in directory '/home/kitchen'
       [DEBUG   ] stdout: 2606:4700:90:0:f22e:fbec:5bed:a9b9
       [INFO    ] Executing command ['dig', '+short', 'minion.id', 'A'] in directory '/home/kitchen'
       [INFO    ] Executing command ['dig', '+short', 'minion.id', 'AAAA'] in directory '/home/kitchen'

After:

       [INFO    ] Executing state file.managed for [/etc/ssh/ssh_known_hosts]
       [DEBUG   ] Returning file list from cache: age=8 cache_time=20 /tmp/kitchen/var/cache/salt/minion/file_lists/roots/base.p
       [DEBUG   ] Returning file list from cache: age=8 cache_time=20 /tmp/kitchen/var/cache/salt/minion/file_lists/roots/base.p
       [DEBUG   ] In saltenv 'base', looking at rel_path 'openssh/files/default/ssh_known_hosts' to resolve 'salt://openssh/files/default/ssh_known_hosts'
       [DEBUG   ] In saltenv 'base', ** considering ** path '/tmp/kitchen/var/cache/salt/minion/files/base/openssh/files/default/ssh_known_hosts' to resolve 'salt://openssh/files/default/ssh_known_hosts'
       [DEBUG   ] Fetching file from saltenv 'base', ** attempting ** 'salt://openssh/files/default/ssh_known_hosts'
       [DEBUG   ] No dest file found
       [INFO    ] Fetching file from saltenv 'base', ** done ** 'openssh/files/default/ssh_known_hosts'
       [DEBUG   ] Jinja search path: ['/tmp/kitchen/var/cache/salt/minion/files/base']
       [INFO    ] Executing command ['dig', '+short', 'cname-to-minion.example.org', 'A'] in directory '/home/kitchen'
       [INFO    ] Executing command ['dig', '+short', 'cname-to-minion.example.org', 'AAAA'] in directory '/home/kitchen'
       [INFO    ] Executing command ['dig', '+short', 'alias.example.org', 'A'] in directory '/home/kitchen'
       [INFO    ] Executing command ['dig', '+short', 'alias.example.org', 'AAAA'] in directory '/home/kitchen'
       [DEBUG   ] LazyLoaded glob_match.match
       [DEBUG   ] LazyLoaded glob_match.match
       [DEBUG   ] LazyLoaded glob_match.match
       [DEBUG   ] LazyLoaded glob_match.match
       [INFO    ] Executing command ['dig', '+short', 'gitlab.com', 'A'] in directory '/home/kitchen'
       [DEBUG   ] stdout: 172.65.251.78
       [INFO    ] Executing command ['dig', '+short', 'gitlab.com', 'AAAA'] in directory '/home/kitchen'
       [DEBUG   ] stdout: 2606:4700:90:0:f22e:fbec:5bed:a9b9
       [INFO    ] Executing command ['dig', '+short', 'minion.id', 'A'] in directory '/home/kitchen'
       [INFO    ] Executing command ['dig', '+short', 'minion.id', 'AAAA'] in directory '/home/kitchen'
       [DEBUG   ] LazyLoaded files.is_text
       [DEBUG   ] LazyLoaded stringutils.get_diff
       [INFO    ] File changed:
       --- 
       +++ 
       @@ -1,4 +1,4 @@
       -github.com,140.82.118.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGm[...]
       +github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGm[...]
        gitlab.com,172.65.251.78,2606:4700:90:0:f22e:fbec:5bed:a9b9 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsj2bN[...]
        minion.id,alias.of.minion.id ssh-rsa [...]
        minion.id,alias.of.minion.id ssh-ed25519 [...]

Documentation checklist

Testing checklist

Additional context

pull-assistant[bot] commented 4 years ago
Score: 1.00

Best reviewed: commit by commit


Optimal code review plan

     fix(jinja): omit_ip_address don't work on some platform

Powered by Pull Assistant. Last update b2d38ae ... b2d38ae. Read the comment docs.

myii commented 4 years ago

Thanks, @baby-gnu.

saltstack-formulas-travis commented 4 years ago

:tada: This PR is included in version 1.2.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: