Help with sensitive flag


#1

Hello,

I want to use sensitive flag with variable, meaning

sensitive #{some_var}

But it is not working.

In my recipe

I have

some_var="true"
if node['debug'] == true
some_var=false
end

execute 'xxx' do
sensitive #{some_var}
command xxx
end

but always shows the command regardless of if the node['debug'] is set/present or not.

sensitive lazy { "#{some_var}" } gives compile error as lazy is undefined method..

Any suggestions?

Thanks in advance

M


#2

Booleans and strings are getting mixed. "#{some_var}" is interpolating the boolean true/false into a string and the sensitive property only takes a boolean.

Maybe try:

execute 'xxx' do
  sensitive true unless node['debug'] == true
  command xxx
end

#3

Thank you so much that helped.

M