Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/ubuntu/install_key.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
define datadog_agent::ubuntu::install_key() {
exec { "key ${name}":
command => "/usr/bin/apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ${name}",
unless => "/usr/bin/apt-key list | grep ${name} | grep expires",
unless => "/usr/bin/apt-key list | grep ${name[-8,8]} | grep expires",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be:

unless  => "/usr/bin/apt-key list | grep #{name[-8,8]} | grep expires",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@truthbk are you sure #{var} is a valid way for variable interpolation? It doesn't work on puppet 5.3.2 for me:

[szponek@szponek tmp]$ cat test1.pp 

$test='12345678'
notify { "Test: #{test[-3,3]}": }

[szponek@szponek tmp]$ puppet apply test1.pp 
Notice: Compiled catalog for szponek.example.net in environment production in 0.01 seconds
Notice: Test: #{test[-3,3]}
Notice: /Stage[main]/Main/Notify[Test: #{test[-3,3]}]/message: defined 'message' as 'Test: #{test[-3,3]}'
Notice: Applied catalog in 0.02 seconds

'$' works as expected so maybe [8-,8] construct is just not supported on puppet < 4.x

[szponek@szponek tmp]$ cat test1.pp 

$test='12345678'
notify { "Test: ${test[-3,3]}": }

[szponek@szponek tmp]$ puppet apply test2.pp 
Notice: Compiled catalog for szponek.example.net in environment production in 0.02 seconds
Notice: Test: 678
Notice: /Stage[main]/Main/Notify[Test: 678]/message: defined 'message' as 'Test: 678'
Notice: Applied catalog in 0.02 seconds

Copy link
Copy Markdown
Member

@truthbk truthbk Dec 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right. Too much chef for me lately. I'll see what I can come up with that works across all versions... I think I can maybe use regsubst for this.

}
}