biemond / biemond-orawls

Puppet 3/4 module for WebLogic provisioning module ( Linux & Solaris )
Apache License 2.0
63 stars 104 forks source link

unable to add new users to groups other than administrators #393

Open reehalhs opened 7 years ago

reehalhs commented 7 years ago

Greetings! I am back with new issue :)

I am not going to talk about the issue of removal of existing users from group - I have found workaround to that problem, however in a use case, where user has to create and add new user(s) to groups other than 'Administrator'. Script to modify groups bombs. Here is what I am trying to do. In my hieradata, I have following: weblogic::wls_users: monitors: faye: ensure: 'present' password: 'XXXXXX'

from this hieradata, I am trying to add a user 'faye' to group 'Monitors' (capitalized somewhere in manifest) however, since in default domain realm, usually, this Monitors, Deployers and Operators have no users in it, thus the following logic in / files / providers / wls_group / modify.py.erb fails: 23 users_to_add = Set(users) - Set(current_users) 24 users_to_remove = Set(current_users) - Set(users)

In my local environment, I have added if condition to only add users, if there are no current users and it works like charm. If it benefit others, then I would suggest to add this enhancement.

Regards, Hardeep

biemond commented 7 years ago

thanks for reporting,

I will test it and see what is going on

reehalhs commented 7 years ago

Sir! I may have reported issue incorrectly. The users are created successfully as well as added to a given group, however I continue to get following Error: Error: undefined method -' for :absent:Symbol Error: /Stage[main]/Dctwls::Configure::Users/Wls_group[mwfcache/Deployers]/users: change from absent to tipu katt failed: undefined method-' for :absent:Symbol

In this case, i am creating two new users [ katt and tipu] and then add then adding them to Deployers group. The users are created as well as added to group, but in between gets this error. I am just not able to debug it further and would really appreciate hint or way to debug it further.

Regards, Hardeep

reehalhs commented 7 years ago

Update on the issue!

The error message above is coming from the following lines from puppet type wls_group/users.rb

def change_to_s(current, should) message = '' unless ((current - should).inspect) == '[]' message << "removing #{(current-should).inspect} " end unless ((should - current).inspect) == '[]' message << "adding #{(should - current).inspect} " end message

While adding users to a group with no members in it. current is 'absent' and it fails in '(current - should). In my local environment, I added check to if current is 'absent'. i then accordingly construct message and is working fine for me.

Thank you very much sir for your continuous support on this module.

Regards,

Hardeep

adamjk-dev commented 6 years ago

Has anyone tried to add a user obtained from ActiveDirectory to a group? I am having issues with this, WLST keeps timing out. I am using orawls v1.0.58.

Puppet code:

  wls_group { 'Deployers':
    ensure                 => 'present',
    authenticationprovider => 'ActiveDirectoryAuthenticator',
    description            => 'SuperUsers',
    realm                  => 'myrealm',
    users                  => 'some_service_account_from_AD',
  }

Puppet output:

Notice: /Stage[main]/Profile::Weblogic_adminserver/Wls_group[Deployers]/authenticationprovider: authenticationprovider changed 'DefaultAuthenticator' to 'ActiveDirectoryAuthenticator'
Notice: /Stage[main]/Profile::Weblogic_adminserver/Wls_group[Deployers]/users: adding ["some_service_account_from_AD"]
Info: modify default/Deployers
Info: Got the right domain default script, now execute WLST
Info: Executing wls-script /tmp/wlstScript20180227-12837-s1v5qj.py with timeout = 120
Info: Connecting to wls on url t3://10.239.153.109:7001
Error: /Stage[main]/Profile::Weblogic_adminserver/Wls_group[Deployers]: Could not evaluate: timeout on reading expected output from daemon process.
adamjk-dev commented 6 years ago

I might have to take that back, this might be how that is done for existing users, by adding them to a role:

 wls_role { 'default/Deployer':
    ensure     => 'present',
    expression => 'Usr(some_service_account_from_AD) | Grp(Deployers)',
    realm      => 'myrealm',
  }