def get_password(type, key)
      unless [:db, :user, :service, :token].include?(type)
        Chef::Log.error "Unsupported type for get_password: #{type}"
        return
      end

      if node[:garcon][:use_databags]
        if type == :token
          secret node[:garcon][:secret][:secrets_data_bag], key
        else
          secret node[:garcon][:secret]["#{type}_passwords_data_bag"], key
        end
      else
        node[:garcon][:secret][key][type]
      end
    end
def get_password(type, key)
      unless [:db, :user, :service, :token].include?(type)
        Chef::Log.error "Unsupported type for get_password: #{type}"
        return
      end

      if node[:garcon][:use_databags]
        if type == :token
          secret node[:garcon][:secret][:secrets_data_bag], key
        else
          secret node[:garcon][:secret]["#{type}_passwords_data_bag"], key
        end
      else
        node[:garcon][:secret][key][type]
      end
    end
Return a password using either data bags or attributes for storage.
 The storage mechanism used is determined by the
 `node[:garcon][:use_databags]` attribute.

 @param [String] type
   password type, can be `:user`, `:service`, `:db` or `:token`

 @param [String] keys
   the identifier of the password