rackerbenoit / chef-flywaydb

Chef cookbook to install flywaydb and execute flyway commands
http://flywaydb.org/
MIT License
3 stars 3 forks source link

On using the sensitive attribute #3

Closed cheeseplus closed 8 years ago

cheeseplus commented 8 years ago

Given our discussion in IRC:

  1. If I have attribute :sensitive, default: true on my resource
  2. And the user does my_resource 'hi' do; puts sensitive; end
  3. I expect it to print true (edited)

In the current Chef, it prints false

To resolve this you'll want to have the below in the resource:

def initialize(*args)
  super
  @sensitive = true
end

The reason that this returns an unexpected value is that the common property sensitive has a default value and because of how the initialization process works, if you're getting the default value for the common sensitive not the default you set. The line below is where the trouble originates from:

https://github.com/chef/chef/blob/master/lib/chef/resource.rb#L161

For the interim:

Cheers!

(feel free to close the issue, just wanted to follow up since we nailed this down)

dhoer commented 8 years ago

Thanks for this! I will discuss with the team what approach we should take.

dhoer commented 8 years ago

This cookbook has had 2 major revs to the version due to security fixes already, so sensitive will be patched at this time.