diff options
Diffstat (limited to 'lib/chef/util/windows')
-rw-r--r-- | lib/chef/util/windows/net_group.rb | 170 | ||||
-rw-r--r-- | lib/chef/util/windows/net_use.rb | 6 | ||||
-rw-r--r-- | lib/chef/util/windows/net_user.rb | 8 | ||||
-rw-r--r-- | lib/chef/util/windows/volume.rb | 4 |
4 files changed, 94 insertions, 94 deletions
diff --git a/lib/chef/util/windows/net_group.rb b/lib/chef/util/windows/net_group.rb index 2085747eb9..5f6bc6a03b 100644 --- a/lib/chef/util/windows/net_group.rb +++ b/lib/chef/util/windows/net_group.rb @@ -1,85 +1,85 @@ -#
-# Author:: Doug MacEachern (<dougm@vmware.com>)
-# Copyright:: Copyright (c) 2010 VMware, Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require 'chef/util/windows'
-require 'chef/win32/net'
-
-#wrapper around a subset of the NetGroup* APIs.
-class Chef::Util::Windows::NetGroup
-
- private
-
- def groupname
- @groupname
- end
-
- public
-
- def initialize(groupname)
- @groupname = groupname
- end
-
- def local_get_members
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_get_members(nil, groupname)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
- end
-
- def local_add
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_add(nil, groupname)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
- end
-
- def local_set_members(members)
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_set_members(nil, groupname, members)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
- end
-
- def local_add_members(members)
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_add_members(nil, groupname, members)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
- end
-
- def local_delete_members(members)
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_del_members(nil, groupname, members)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
-
- end
-
- def local_delete
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_del(nil, groupname)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
- end
-end
+# +# Author:: Doug MacEachern (<dougm@vmware.com>) +# Copyright:: Copyright (c) 2010 VMware, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require "chef/util/windows" +require "chef/win32/net" + +#wrapper around a subset of the NetGroup* APIs. +class Chef::Util::Windows::NetGroup + + private + + def groupname + @groupname + end + + public + + def initialize(groupname) + @groupname = groupname + end + + def local_get_members + begin + Chef::ReservedNames::Win32::NetUser::net_local_group_get_members(nil, groupname) + rescue Chef::Exceptions::Win32NetAPIError => e + raise ArgumentError, e.msg + end + end + + def local_add + begin + Chef::ReservedNames::Win32::NetUser::net_local_group_add(nil, groupname) + rescue Chef::Exceptions::Win32NetAPIError => e + raise ArgumentError, e.msg + end + end + + def local_set_members(members) + begin + Chef::ReservedNames::Win32::NetUser::net_local_group_set_members(nil, groupname, members) + rescue Chef::Exceptions::Win32NetAPIError => e + raise ArgumentError, e.msg + end + end + + def local_add_members(members) + begin + Chef::ReservedNames::Win32::NetUser::net_local_group_add_members(nil, groupname, members) + rescue Chef::Exceptions::Win32NetAPIError => e + raise ArgumentError, e.msg + end + end + + def local_delete_members(members) + begin + Chef::ReservedNames::Win32::NetUser::net_local_group_del_members(nil, groupname, members) + rescue Chef::Exceptions::Win32NetAPIError => e + raise ArgumentError, e.msg + end + + end + + def local_delete + begin + Chef::ReservedNames::Win32::NetUser::net_local_group_del(nil, groupname) + rescue Chef::Exceptions::Win32NetAPIError => e + raise ArgumentError, e.msg + end + end +end diff --git a/lib/chef/util/windows/net_use.rb b/lib/chef/util/windows/net_use.rb index b94576e702..e70df6e42b 100644 --- a/lib/chef/util/windows/net_use.rb +++ b/lib/chef/util/windows/net_use.rb @@ -20,8 +20,8 @@ #see also: WNetAddConnection2 and WNetAddConnection3 #see also cmd.exe: net use /? -require 'chef/util/windows' -require 'chef/win32/net' +require "chef/util/windows" +require "chef/win32/net" class Chef::Util::Windows::NetUse < Chef::Util::Windows def initialize(localname) @@ -53,7 +53,7 @@ class Chef::Util::Windows::NetUse < Chef::Util::Windows def from_use_info_struct(ui2_hash) ui2_hash.inject({}) do |memo, (k,v)| - memo[k.to_s.sub('ui2_', '').to_sym] = v + memo[k.to_s.sub("ui2_", "").to_sym] = v memo end end diff --git a/lib/chef/util/windows/net_user.rb b/lib/chef/util/windows/net_user.rb index 4ce051228a..b8e9b63571 100644 --- a/lib/chef/util/windows/net_user.rb +++ b/lib/chef/util/windows/net_user.rb @@ -16,10 +16,10 @@ # limitations under the License. # -require 'chef/util/windows' -require 'chef/exceptions' -require 'chef/win32/net' -require 'chef/win32/security' +require "chef/util/windows" +require "chef/exceptions" +require "chef/win32/net" +require "chef/win32/security" #wrapper around a subset of the NetUser* APIs. #nothing Chef specific, but not complete enough to be its own gem, so util for now. diff --git a/lib/chef/util/windows/volume.rb b/lib/chef/util/windows/volume.rb index 6e45594ba6..7b24ec37aa 100644 --- a/lib/chef/util/windows/volume.rb +++ b/lib/chef/util/windows/volume.rb @@ -18,8 +18,8 @@ #simple wrapper around Volume APIs. might be possible with WMI, but possibly more complex. -require 'chef/win32/api/file' -require 'chef/util/windows' +require "chef/win32/api/file" +require "chef/util/windows" class Chef::Util::Windows::Volume < Chef::Util::Windows attr_reader :mount_point |