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

Streamhost resource does not remove the file #1304

Closed
aleksmark opened this issue Jan 29, 2019 · 1 comment
Closed

Streamhost resource does not remove the file #1304

aleksmark opened this issue Jan 29, 2019 · 1 comment

Comments

@aleksmark
Copy link
Contributor

Streamhost resource does not remove the file when ensure => 'absent' is set.

In the resource there is a default for file resource, where the ensure is set, but that default does not apply on concat resource where the /etc/nginx/streams-available/* config file is managed.

https://github.com/voxpupuli/puppet-nginx/blob/master/manifests/resource/streamhost.pp#L88:97
https://github.com/voxpupuli/puppet-nginx/blob/master/manifests/resource/streamhost.pp#L105-L111

Note: Symlink from /etc/nginx/streams-enabled/* is removed

  File {
    ensure => $ensure ? {
      'absent' => absent,
      default  => 'file',
    },
    notify => Class['nginx::service'],
    owner  => $owner,
    group  => $group,
    mode   => $mode,
  }
  concat { $config_file:
    owner   => $owner,
    group   => $group,
    mode    => $mode,
    notify  => Class['nginx::service'],
    require => File[$streamhost_dir],
  }

Adding ensure => $ensure on concat itself will fix the issue. I opened the pull request.

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.1
  • Ruby: ruby 2.0.0p648
  • Distribution: Amazon Linux AMI 2018.03 (RHEL 7 / CENTOS 7)
  • Module version: 0.15.0

How to reproduce (e.g Puppet code you use)

create a config file

nginx::nginx_streamhosts:
  'test':
    listen_port:           14070
    listen_options:        'udp'
    proxy_read_timeout:    '1'
    proxy_connect_timeout: '1'

after puppet run file is created: /etc/nginx/streams-available/test.conf

remove the file

nginx::nginx_streamhosts:
  'test':
    ensure: 'absent'

What are you seeing

the file /etc/nginx/streams-available/test.conf is NOT removed

What behaviour did you expect instead

the file /etc/nginx/streams-available/test.conf is removed

@aleksmark
Copy link
Contributor Author

bugfixed merged

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