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

location_custom_cfg_append keeps on refreshing nginx service every puppet run. #503

Closed
severity1 opened this issue Nov 12, 2014 · 4 comments
Labels
needs-feedback Further information is requested

Comments

@severity1
Copy link

I encountered this weird issue wherein location_custom_cfg_append keeps on refreshing nginx::service every puppet run. See snippet below.

nginx::resource::location { 'test-support-location-7':
      ensure                     => 'present',
      location                   => '~ \.php$',
      fastcgi                    => 'php5-fpm',
      fastcgi_split_path         => '^(.+\.php)(/.+)$',
      location_cfg_append        => {
        'fastcgi_index' => 'index.php',
      },
      location_custom_cfg_append => {
          'if ( $args = "/Base/register" )' => '{return 301 https://www.wxyz.com/; }',
          'if ( $args = "/Kb/"  )'                => '{ return 301 https://www.wxyz..com/; }',
          'if ( $args = "/Base/index" )'    => '{ return 301 https://www.wxyz.com/; }',
          'if ( $args = "/Ns/" )'                          => '{ return 301 https://www.wxyz.com/; }',
      },
      vhost                      => 'test-support',
      priority                   => 507,
    }

doing a puppet run will always restart the nginx::service if I add that line. seems to me that everytime puppet run is executed it recreates the location_custom_cfg_append temp file even if there are no changes thus always triggering refresh schedule for nginx service.

notice: /Stage[main]/Ss4_app::Configs/Nginx::Resource::Location[test-support-location-7]/Concat::Fragment[5be7a61224e4e8ac1e165d94b606a250]/File[/var/lib/puppet/concat/_etc_nginx_sites-available_test-support.conf/fragments/507_5be7a61224e4e8ac1e165d94b606a250]/content: content changed '{md5}63fccb24997c285116e142f17d8024cb' to '{md5}fb3428b770524d088b47f473035a4faf'
notice: /Stage[main]/Ss4_app::Configs/Nginx::Resource::Vhost[test-support]/Concat[/etc/nginx/sites-available/test-support.conf]/Exec[concat_/etc/nginx/sites-available/test-support.conf]/returns: executed successfully
notice: /Stage[main]/Ss4_app::Configs/Nginx::Resource::Vhost[test-support]/Concat[/etc/nginx/sites-available/test-support.conf]/Exec[concat_/etc/nginx/sites-available/test-support.conf]: Triggered 'refresh' from 1 events
@severity1
Copy link
Author

it seems replacing this line in nginx/templates/vhost/location_footer.erb

<%- @location_custom_cfg_append.each do |key,value| -%>

with...

<%- @location_custom_cfg_append..sort_by {|k,v| k}.each do |key,value| -%>

fixes the issue. this will not recreate the vhost.

@mbornoz
Copy link
Contributor

mbornoz commented Dec 17, 2014

The first hash level is already sorted, see https://github.com/jfryman/puppet-nginx/blob/master/templates/vhost/location_footer.erb#L2 and I just proposed #532 for the sub level

@3flex
Copy link
Contributor

3flex commented Apr 10, 2015

@severity1 did the merge of #532 solve your issue?

@3flex 3flex added the needs-feedback Further information is requested label Apr 10, 2015
@3flex
Copy link
Contributor

3flex commented May 6, 2015

I'm closing this for now. @severity1 please comment if you have any information to add and I'll reopen. Thanks!

@3flex 3flex closed this as completed May 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-feedback Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants