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

Missing exec in resources_index with shared block and require #146

Open
anthonyryan1 opened this issue Aug 27, 2023 · 0 comments
Open

Missing exec in resources_index with shared block and require #146

anthonyryan1 opened this issue Aug 27, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@anthonyryan1
Copy link

anthonyryan1 commented Aug 27, 2023

Describe the Bug

I've been developing a new puppet-lint plugin and believe I found a bug in the generation of resource_indexes. Having two commands in the same exec block with a require causes only one of them to be linted.

Expected Behavior

There should be two exec resources with command and require, so that each can be linted properly, instead of only the first in the exec block.

Steps to Reproduce

test.pp

file {
  '/tmp/example.txt':
    content => 'example require file';
}

exec {
  'command1':
    command => '/usr/bin/true',
    require => File['/tmp/example.txt'];
  'command2':
    command => '/usr/bin/true',
    require => File['/tmp/example.txt'];
}

test-lint.rb

PuppetLint.new_check(:string_exec_command) do
  def check
    resource_indexes.each do |resource|
      print(resource[:param_tokens])
      print("\n")
    end
  end
end

puppet-lint --load test-lint.rb test.pp

puppet-lint --load test-lint.rb test.pp
[<Token :NAME (content) @3:5>]
[<Token :NAME (command) @8:5>, <Token :NAME (require) @9:5>]

Environment

  • puppet-lint 4.1.0
  • Gentoo Linux
@anthonyryan1 anthonyryan1 added the bug Something isn't working label Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant