Skip to content

Instantly share code, notes, and snippets.

Created March 22, 2016 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4ec6bf090b200f0417a4 to your computer and use it in GitHub Desktop.
Save anonymous/4ec6bf090b200f0417a4 to your computer and use it in GitHub Desktop.
configs = Marshal.load(Marshal.dump(node['caws-rundeck']['jaas']))
configs.each do |config|
name = config['name']
Chef::Log.error("Config: #{config}, Name: #{name}, configName: #{config['name']}, credentials: #{credentials[name]}")
Chef::Log.error(name.class)
Chef::Log.error(name.method(:nil?).source_location)
Chef::Log.error(name.nil? == nil)
Chef::Log.error(name)
Chef::Log.error(config[name].nil?)
Chef::Log.error(credentials.key?(name))
if ! name.nil? && ! config[name].nil? && credentials.key?(name)
credentials[name].each do |k,v|
Chef::Log.error("Key: #{k}, Value: #{v}")
config[name]['options'][k] = v
end
end
end
Output:
[2016-03-22T15:13:27+00:00] ERROR: Config: {"module"=>"com.dtolabs.rundeck.jetty.jaas.JettyCachingLdapLoginModule", "name"=>"cawsad", "flag"=>"sufficient", "options"=>{"debug"=>"true", "contextFactory"=>"com.sun.jndi.ldap.LdapCtxFactory", "providerUrl"=>"ldap://x.x.x.x", "bindDn"=>"x.x.x.x.x", "bindPassword"=>"", "authenticationMethod"=>"simple", "forceBindingLogin"=>"true", "userBaseDn"=>"x.x.x.x", "userRdnAttribute"=>"sAMAccountName", "userIdAttribute"=>"sAMAccountName", "userPasswordAttribute"=>"unicodePwd", "userObjectClass"=>"user", "roleBaseDn"=>"x.x.x.x", "roleNameAttribute"=>"cn", "roleMemberAttribute"=>"member", "roleObjectClass"=>"group", "cacheDurationMillis"=>"300000", "reportStatistics"=>"true"}}, Name: cawsad, configName: cawsad, credentials: {"bindPassword"=>"xxxx"}
[2016-03-22T15:13:27+00:00] ERROR: String
[2016-03-22T15:13:27+00:00] ERROR: nil
[2016-03-22T15:13:27+00:00] ERROR: nil
[2016-03-22T15:13:27+00:00] ERROR: cawsad
[2016-03-22T15:13:27+00:00] ERROR: true
[2016-03-22T15:13:27+00:00] ERROR: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment