saltstack-formulas / openssh-formula

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

Changed expr_form to tgt_type for deprecation reasons. #122

Closed Mario-F closed 6 years ago

siretart commented 6 years ago

This breaks salt versions < 2017.7.0, and more specifically the version of salt-minion currently found in Debian Stable (version 9, aka 'stretch').

I managed to get it to work with this patch:

diff --git a/openssh/files/ssh_known_hosts b/openssh/files/ssh_known_hosts                                                                                    
index 0839c46..5bf8f68 100644                                                                                                                                 
--- a/openssh/files/ssh_known_hosts                                                                                                                           
+++ b/openssh/files/ssh_known_hosts                                                                                                                           
@@ -71,8 +71,13 @@                                                                                                                                            
 {%- endfor -%}                                                                                                                                               

 {#- Salt Mine #}                                                                                                                                             
+{%- if salt['pkg.version_cmp'](grains['saltversion'], '2017.7.0') > 0 -%}                                                                                    
 {%- set host_keys = salt['mine.get'](target, keys_function, tgt_type=tgt_type) -%}                                                                           
 {%- set host_names = salt['mine.get'](target, hostname_function, tgt_type=tgt_type) -%}                                                                      
+{%- else -%}                                                                                                                                                 
+{%- set host_keys = salt['mine.get'](target, keys_function, expr_form=tgt_type) -%}                                                                          
+{%- set host_names = salt['mine.get'](target, hostname_function, expr_form=tgt_type) -%}                                                                     
+{%- endif -%}                                                                                                                                                

 {#- Salt SSH (if any) #}                                                                                                                                     
 {%- for minion_id, minion_host_keys in salt['pillar.get'](                                                                                                   

Would a PR with this patch be acceptable?

javierbertoli commented 6 years ago

Debian 9 ships SaltStack 2016.11.2. Supporting this old versions through conditionals creeping into the formula is not my kind of thing and I'd rather use upstream's packages.

All that said, in this particular case it seems to be a simple, not-that-disruptive patch, so I'd say go ahead, @siretart? :smile: