Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules.sls: order breaks some modules #238

Open
netzvieh opened this issue Sep 12, 2018 · 0 comments
Open

modules.sls: order breaks some modules #238

netzvieh opened this issue Sep 12, 2018 · 0 comments

Comments

@netzvieh
Copy link
Contributor

netzvieh commented Sep 12, 2018

the order argument in modules.sls breaks at least one Apache module. When using the proxy_http module you need to include proxy before proxy_http. Using the order argument for the a2enmod command makes salt ignore the order specified in pillar and sorts alphabetically which leads to proxy_http coming before proxy.

Test State: (copied from modules.sls and cleaned)

{% for module in salt['pillar.get']('apache:modules:enabled', []) %}
a2enmod {{ module }}:
  cmd.run:
    - unless: egrep "^APACHE_MODULES=" /etc/sysconfig/apache2 | grep -w {{ module }}
    - order: 225
{% endfor %}

{% for module in salt['pillar.get']('apache:modules:disabled', []) %}
a2dismod -f {{ module }}:
  cmd.run:
    - onlyif: egrep "^APACHE_MODULES=" /etc/sysconfig/apache2 | grep -w {{ module }}
    - order: 225
{% endfor %}

Pillar:

apache:
  modules:
    enabled:
      - rewrite
      - proxy
      - proxy_http
      - substitute
      - php7
      - filter
      - access_compat

Actual Result:

# salt-call state.apply test
local:                                  
----------                                                                               
          ID: a2enmod access_compat                                                                                
    Function: cmd.run                                                                
      Result: True                                                                              
     Comment: Command "a2enmod access_compat" run                                       
     Started: 11:28:57.992950                                             
    Duration: 20.467 ms                                                                      
     Changes:                                                             
              ----------                                                                                 
              pid:                                                                                                   
                  16953                                                              
              retcode:                                                            
                  0                                                       
              stderr:                                                               
              stdout:                                                                                                                                       
----------                                                                
          ID: a2enmod filter                                                                                                                                                           
    Function: cmd.run                               
      Result: True                                     
     Comment: Command "a2enmod filter" run                              
     Started: 11:28:58.013711                                               
    Duration: 19.171 ms                                                                                                      
     Changes:                                                                                                                                                                         
              ----------                     
              pid:                        
                  16964                               
              retcode:             
                  0                                                                                                         
              stderr:                                                                                                                                                                             
              stdout:                                                             
----------                   
          ID: a2enmod php7                                                    
    Function: cmd.run            
      Result: True                                                                                                                      
     Comment: Command "a2enmod php7" run                                                                                                                                                  
     Started: 11:28:58.033175                                    
    Duration: 19.873 ms                  
     Changes:                                                     
              ----------                                  
              pid:                                                                                                              
                  16975                                                                                                                                                                                                                                                                                          
              retcode:                                                                                                                                                                                                                                                                                 
                  0                                                                                                                                                                                                                                                                                
              stderr:                                                                                                                                                                                                        
              stdout:                                 
----------                                
          ID: a2enmod proxy_http                
    Function: cmd.run                                     
      Result: True                                                          
     Comment: Command "a2enmod proxy_http" run
     Started: 11:28:58.053315
    Duration: 19.011 ms                                                     
     Changes:                
              ----------             
              pid:                         
                  16986                                                                                                                                        
              retcode:                                                                                                         
                  0                                                                  
              stderr:        
              stdout:                                                
----------                                                
          ID: a2enmod proxy             
    Function: cmd.run                                                   
      Result: True                      
     Comment: Command "a2enmod proxy" run                            
     Started: 11:28:58.072602                                                                                                              
    Duration: 20.342 ms          
     Changes:                                                     
              ----------     
              pid:                                        
                  16997                                                         
              retcode:          
                  0                     
              stderr:                                                                    
              stdout:                                                                                                              
----------                                                           
          ID: a2enmod rewrite             
    Function: cmd.run        
      Result: True                                                        
     Comment: Command "a2enmod rewrite" run
     Started: 11:28:58.093213               
    Duration: 21.251 ms             
     Changes:                                                                                                                   
              ----------                                                          
              pid:                      
                  17008 
              retcode:                                                              
                  0                                
              stderr:                 
              stdout:
----------
          ID: a2enmod substitute
    Function: cmd.run
      Result: True
     Comment: Command "a2enmod substitute" run
     Started: 11:28:58.114814
    Duration: 20.412 ms
     Changes:   
              ----------
              pid:
                  17019
              retcode:
                  0
              stderr:
              stdout:

Summary for local
------------
Succeeded: 7 (changed=7)
Failed:    0
------------
Total states run:     7
Total run time: 140.527 ms

Expected Result:

# salt-call state.apply test
local:
----------
          ID: a2enmod rewrite
    Function: cmd.run
      Result: True
     Comment: Command "a2enmod rewrite" run
     Started: 11:28:20.483265
    Duration: 21.126 ms
     Changes:   
              ----------
              pid:
                  16852
              retcode:
                  0
              stderr:
              stdout:
----------
          ID: a2enmod proxy
    Function: cmd.run
      Result: True
     Comment: Command "a2enmod proxy" run
     Started: 11:28:20.504710
    Duration: 24.208 ms
     Changes:   
              ----------
              pid:
                  16863
              retcode:
                  0
              stderr:
              stdout:
----------
          ID: a2enmod proxy_http
    Function: cmd.run
      Result: True
     Comment: Command "a2enmod proxy_http" run
     Started: 11:28:20.529185
    Duration: 23.29 ms
     Changes:   
              ----------
              pid:
                  16874
              retcode:
                  0
              stderr:
              stdout:
----------
          ID: a2enmod substitute
    Function: cmd.run
      Result: True
     Comment: Command "a2enmod substitute" run
     Started: 11:28:20.552810
    Duration: 23.075 ms
     Changes:   
              ----------
              pid:
                  16885
              retcode:
                  0
              stderr:
              stdout:
----------
          ID: a2enmod php7
    Function: cmd.run
      Result: True
     Comment: Command "a2enmod php7" run
     Started: 11:28:20.576213
    Duration: 22.415 ms
     Changes:   
              ----------
              pid:
                  16896
              retcode:
                  0
              stderr:
              stdout:
----------
          ID: a2enmod filter
    Function: cmd.run
      Result: True
     Comment: Command "a2enmod filter" run
     Started: 11:28:20.598945
    Duration: 23.939 ms
     Changes:   
              ----------
              pid:
                  16907
              retcode:
                  0
              stderr:
              stdout:
----------
          ID: a2enmod access_compat
    Function: cmd.run
      Result: True
     Comment: Command "a2enmod access_compat" run
     Started: 11:28:20.623191
    Duration: 23.598 ms
     Changes:   
              ----------
              pid:
                  16918
              retcode:
                  0
              stderr:
              stdout:

Summary for local
------------
Succeeded: 7 (changed=7)
Failed:    0
------------
Total states run:     7
Total run time: 161.651 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant