From de5b62ad16b949946e09d43797ee30dfc2ae1ec1 Mon Sep 17 00:00:00 2001 From: "rob.houghton" Date: Tue, 24 May 2016 15:32:28 +0100 Subject: [PATCH 1/2] Added parameter manage_group to wls_group In relation to issue #329 --- lib/puppet/type/wls_group/manage_group.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/puppet/type/wls_group/manage_group.rb diff --git a/lib/puppet/type/wls_group/manage_group.rb b/lib/puppet/type/wls_group/manage_group.rb new file mode 100644 index 00000000..65aaa000 --- /dev/null +++ b/lib/puppet/type/wls_group/manage_group.rb @@ -0,0 +1,14 @@ +newparam(:manage_group) do + include EasyType + include EasyType::Validators::Name + + desc 'Modify Current Group Members' + defaultto 'true' + + newvalues('true', 'false') + + to_translate_to_resource do | raw_resource| + raw_resource['manage_group'] + end + +end From 68ee0c8bb74961d2fb2d2d5a2f2a7652cf01158f Mon Sep 17 00:00:00 2001 From: "rob.houghton" Date: Tue, 24 May 2016 15:32:28 +0100 Subject: [PATCH 2/2] Added parameter manage_group to wls_group In relation to issue #329 --- files/providers/wls_group/modify.py.erb | 12 +++++++++--- lib/puppet/type/wls_group.rb | 1 + lib/puppet/type/wls_group/manage_group.rb | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 lib/puppet/type/wls_group/manage_group.rb diff --git a/files/providers/wls_group/modify.py.erb b/files/providers/wls_group/modify.py.erb index a906ce45..b8aa7c0b 100644 --- a/files/providers/wls_group/modify.py.erb +++ b/files/providers/wls_group/modify.py.erb @@ -8,6 +8,7 @@ realm = '<%= realm %>' authenticationprovider = '<%= authenticationprovider %>' description = '<%= description %>' users = '<%= users %>'.split(",") +manage_group = '<%= manage_group %>' try: cd('/') @@ -28,9 +29,14 @@ try: for user in users_to_add: print 'Adding user: ' + user atnr.addMemberToGroup(name,user) - for user in users_to_remove: - print 'Removing user: ' + user - atnr.removeMemberFromGroup(name,user) + + if manage_group == 'true': + for user in users_to_remove: + print 'Removing user: ' + user + atnr.removeMemberFromGroup(name,user) + else: + print 'Skipping Removing Users' + report_back_success() except: diff --git a/lib/puppet/type/wls_group.rb b/lib/puppet/type/wls_group.rb index 8c8579c5..fe3092cc 100644 --- a/lib/puppet/type/wls_group.rb +++ b/lib/puppet/type/wls_group.rb @@ -41,6 +41,7 @@ module Puppet parameter :name parameter :group_name parameter :timeout + parameter :manage_group property :realm property :authenticationprovider property :users diff --git a/lib/puppet/type/wls_group/manage_group.rb b/lib/puppet/type/wls_group/manage_group.rb new file mode 100644 index 00000000..65aaa000 --- /dev/null +++ b/lib/puppet/type/wls_group/manage_group.rb @@ -0,0 +1,14 @@ +newparam(:manage_group) do + include EasyType + include EasyType::Validators::Name + + desc 'Modify Current Group Members' + defaultto 'true' + + newvalues('true', 'false') + + to_translate_to_resource do | raw_resource| + raw_resource['manage_group'] + end + +end