Sha256: a32a5eb903e00e3c5f435365a0215d88dc5de8133461bc7fc902a7f3ffad1487
Contents?: true
Size: 955 Bytes
Versions: 33
Compression:
Stored size: 955 Bytes
Contents
module PSWindows::Group include Beaker::CommandFactory def group_list(&block) execute('cmd /c echo "" | wmic group where localaccount="true" get name /format:value') do |result| groups = [] result.stdout.each_line do |line| groups << (line.match(/^Name=(.+)$/) or next)[1] end yield result if block_given? groups end end def group_get(name, &block) execute("net localgroup \"#{name}\"") do |result| fail_test "failed to get group #{name}" if result.exit_code != 0 yield result if block_given? end end def group_gid(name) raise NotImplementedError, "Can't retrieve group gid on a Windows host" end def group_present(name, &block) execute("net localgroup /add \"#{name}\"", {:acceptable_exit_codes => [0,2]}, &block) end def group_absent(name, &block) execute("net localgroup /delete \"#{name}\"", {:acceptable_exit_codes => [0,2]}, &block) end end
Version data entries
33 entries across 33 versions & 1 rubygems