Class: Chef::Provider::Group::Windows
- Inherits:
-
Chef::Provider::Group
- Object
- Chef::Provider
- Chef::Provider::Group
- Chef::Provider::Group::Windows
- Defined in:
- lib/chef/provider/group/windows.rb
Instance Attribute Summary
Attributes inherited from Chef::Provider::Group
Attributes inherited from Chef::Provider
#current_resource, #new_resource, #run_context
Instance Method Summary collapse
- #create_group ⇒ Object
-
#initialize(new_resource, run_context) ⇒ Windows
constructor
A new instance of Windows.
- #load_current_resource ⇒ Object
- #manage_group ⇒ Object
- #remove_group ⇒ Object
Methods inherited from Chef::Provider::Group
#action_create, #action_manage, #action_modify, #action_remove, #compare_group
Methods included from Mixin::Command
#chdir_or_tmpdir, #handle_command_failures, #not_if, #only_if, #output_of_command, #run_command, #run_command_with_systems_locale
Methods included from Mixin::Command::Windows
Methods included from Mixin::Command::Unix
Methods inherited from Chef::Provider
#action_nothing, build_from_file, #cookbook_name, #node, #resource_collection
Methods included from Mixin::ConvertToClassName
#convert_to_class_name, #convert_to_snake_case, #filename_to_qualified_string, #snake_case_basename
Methods included from Mixin::RecipeDefinitionDSLCore
Methods included from Mixin::Language
#data_bag, #data_bag_item, #platform?, #search, #value_for_platform
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Chef::Mixin::RecipeDefinitionDSLCore
Instance Method Details
#create_group ⇒ Object
53 54 55 56 |
# File 'lib/chef/provider/group/windows.rb', line 53 def create_group @net_group.local_add manage_group end |
#load_current_resource ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/chef/provider/group/windows.rb', line 34 def load_current_resource @current_resource = Chef::Resource::Group.new(@new_resource.name) @current_resource.group_name(@new_resource.group_name) members = nil begin members = @net_group.local_get_members rescue => e @group_exists = false Chef::Log.debug("#{@new_resource}: group does not exist") end if members @current_resource.members(members) end @current_resource end |
#manage_group ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/chef/provider/group/windows.rb', line 58 def manage_group if @new_resource.append begin #ERROR_MEMBER_IN_ALIAS if a member already exists in the group @net_group.local_add_members(@new_resource.members) rescue members = @new_resource.members + @current_resource.members @net_group.local_set_members(members.uniq) end else @net_group.local_set_members(@new_resource.members) end end |
#remove_group ⇒ Object
72 73 74 |
# File 'lib/chef/provider/group/windows.rb', line 72 def remove_group @net_group.local_delete end |