puppet 5.5.6-x86-mingw32 → 5.5.7-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +12 -12
- data/Rakefile +9 -0
- data/lib/puppet/application.rb +5 -0
- data/lib/puppet/application/apply.rb +1 -0
- data/lib/puppet/application/master.rb +9 -7
- data/lib/puppet/application/script.rb +1 -1
- data/lib/puppet/defaults.rb +51 -31
- data/lib/puppet/etc.rb +20 -0
- data/lib/puppet/file_serving/fileset.rb +1 -1
- data/lib/puppet/functions.rb +123 -0
- data/lib/puppet/functions/new.rb +37 -53
- data/lib/puppet/functions/warning.rb +1 -1
- data/lib/puppet/loaders.rb +1 -0
- data/lib/puppet/parser/functions.rb +3 -1
- data/lib/puppet/parser/functions/sprintf.rb +12 -1
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +16 -0
- data/lib/puppet/pops/evaluator/runtime3_support.rb +3 -4
- data/lib/puppet/pops/issues.rb +8 -0
- data/lib/puppet/pops/loader/loader.rb +2 -2
- data/lib/puppet/pops/loader/loader_paths.rb +3 -1
- data/lib/puppet/pops/loader/module_loaders.rb +1 -1
- data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +62 -0
- data/lib/puppet/pops/loaders.rb +5 -21
- data/lib/puppet/pops/parser/heredoc_support.rb +1 -2
- data/lib/puppet/pops/parser/lexer2.rb +1 -1
- data/lib/puppet/pops/validation/checker4_0.rb +31 -6
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
- data/lib/puppet/property/keyvalue.rb +70 -8
- data/lib/puppet/provider/aix_object.rb +483 -0
- data/lib/puppet/provider/exec.rb +54 -57
- data/lib/puppet/provider/group/aix.rb +40 -115
- data/lib/puppet/provider/group/pw.rb +4 -8
- data/lib/puppet/provider/group/windows_adsi.rb +7 -4
- data/lib/puppet/provider/nameservice.rb +1 -25
- data/lib/puppet/provider/nameservice/directoryservice.rb +5 -3
- data/lib/puppet/provider/package/portage.rb +2 -2
- data/lib/puppet/provider/package/windows.rb +2 -2
- data/lib/puppet/provider/package/windows/exe_package.rb +3 -10
- data/lib/puppet/provider/package/zypper.rb +1 -1
- data/lib/puppet/provider/service/launchd.rb +19 -3
- data/lib/puppet/provider/service/windows.rb +49 -40
- data/lib/puppet/provider/user/aix.rb +180 -246
- data/lib/puppet/provider/user/windows_adsi.rb +9 -1
- data/lib/puppet/resource/catalog.rb +1 -5
- data/lib/puppet/type/augeas.rb +1 -1
- data/lib/puppet/type/exec.rb +16 -14
- data/lib/puppet/type/file.rb +2 -2
- data/lib/puppet/type/file/source.rb +9 -5
- data/lib/puppet/type/group.rb +65 -23
- data/lib/puppet/type/k5login.rb +2 -2
- data/lib/puppet/type/notify.rb +1 -1
- data/lib/puppet/type/package.rb +3 -6
- data/lib/puppet/type/resources.rb +12 -2
- data/lib/puppet/type/schedule.rb +8 -1
- data/lib/puppet/type/selboolean.rb +2 -2
- data/lib/puppet/type/selmodule.rb +3 -4
- data/lib/puppet/type/service.rb +2 -5
- data/lib/puppet/type/tidy.rb +1 -1
- data/lib/puppet/type/user.rb +15 -20
- data/lib/puppet/type/yumrepo.rb +2 -2
- data/lib/puppet/type/zone.rb +2 -2
- data/lib/puppet/util.rb +7 -3
- data/lib/puppet/util/execution.rb +15 -1
- data/lib/puppet/util/posix.rb +15 -0
- data/lib/puppet/util/storage.rb +12 -0
- data/lib/puppet/util/windows.rb +4 -2
- data/lib/puppet/util/windows/adsi.rb +235 -205
- data/lib/puppet/util/windows/process.rb +23 -3
- data/lib/puppet/util/windows/security.rb +14 -0
- data/lib/puppet/util/windows/service.rb +977 -0
- data/lib/puppet/util/windows/user.rb +3 -5
- data/lib/puppet/version.rb +1 -1
- data/locales/ja/puppet.po +705 -374
- data/locales/puppet.pot +485 -261
- data/man/man5/puppet.conf.5 +36 -15
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-ca.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-cert.8 +1 -1
- data/man/man8/puppet-certificate.8 +1 -1
- data/man/man8/puppet-certificate_request.8 +1 -1
- data/man/man8/puppet-certificate_revocation_list.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-master.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/unit/provider/aix_object/aix_colon_list_real_world_input.out +1 -0
- data/spec/fixtures/unit/provider/aix_object/aix_colon_list_real_world_output.out +1 -0
- data/spec/fixtures/unit/provider/user/aix/aix_passwd_file.out +32 -0
- data/spec/integration/parser/collection_spec.rb +4 -8
- data/spec/integration/provider/service/windows_spec.rb +5 -5
- data/spec/integration/type/file_spec.rb +6 -6
- data/spec/integration/util/windows/adsi_spec.rb +6 -5
- data/spec/integration/util/windows/security_spec.rb +10 -7
- data/spec/integration/util/windows/user_spec.rb +37 -17
- data/spec/spec_helper.rb +0 -1
- data/spec/unit/application/apply_spec.rb +41 -2
- data/spec/unit/application/master_spec.rb +7 -0
- data/spec/unit/application_spec.rb +21 -3
- data/spec/unit/defaults_spec.rb +20 -0
- data/spec/unit/etc_spec.rb +25 -0
- data/spec/unit/file_serving/fileset_spec.rb +11 -11
- data/spec/unit/gettext/config_spec.rb +1 -1
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +6 -6
- data/spec/unit/pops/loaders/loaders_spec.rb +40 -7
- data/spec/unit/pops/parser/parse_heredoc_spec.rb +16 -0
- data/spec/unit/pops/validator/validator_spec.rb +129 -10
- data/spec/unit/property/keyvalue_spec.rb +97 -6
- data/spec/unit/provider/aix_object_spec.rb +805 -0
- data/spec/unit/provider/group/aix_spec.rb +57 -0
- data/spec/unit/provider/group/pw_spec.rb +0 -6
- data/spec/unit/provider/group/windows_adsi_spec.rb +34 -35
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +2 -2
- data/spec/unit/provider/package/windows/exe_package_spec.rb +3 -3
- data/spec/unit/provider/package/windows_spec.rb +4 -4
- data/spec/unit/provider/service/launchd_spec.rb +19 -0
- data/spec/unit/provider/service/windows_spec.rb +71 -78
- data/spec/unit/provider/user/aix_spec.rb +162 -116
- data/spec/unit/provider/user/windows_adsi_spec.rb +4 -4
- data/spec/unit/resource/catalog_spec.rb +2 -2
- data/spec/unit/ssl/certificate_authority_spec.rb +0 -1
- data/spec/unit/type/group_spec.rb +111 -13
- data/spec/unit/type/resources_spec.rb +18 -0
- data/spec/unit/util/execution_spec.rb +77 -0
- data/spec/unit/util/posix_spec.rb +28 -0
- data/spec/unit/util/storage_spec.rb +107 -0
- data/spec/unit/util/windows/adsi_spec.rb +108 -13
- data/spec/unit/util/windows/service_spec.rb +669 -0
- metadata +17 -5
- data/lib/puppet/provider/aixobject.rb +0 -392
- data/spec/unit/provider/aixobject_spec.rb +0 -101
data/lib/puppet/provider/exec.rb
CHANGED
@@ -4,71 +4,68 @@ require 'puppet/util/execution'
|
|
4
4
|
class Puppet::Provider::Exec < Puppet::Provider
|
5
5
|
include Puppet::Util::Execution
|
6
6
|
|
7
|
-
def
|
8
|
-
|
9
|
-
sensitive = resource.parameters[:command].sensitive
|
7
|
+
def environment
|
8
|
+
env = {}
|
10
9
|
|
11
|
-
|
10
|
+
if (path = resource[:path])
|
11
|
+
env[:PATH] = path.join(File::PATH_SEPARATOR)
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
return env unless (envlist = resource[:environment])
|
15
|
+
|
16
|
+
envlist = [envlist] unless envlist.is_a? Array
|
17
|
+
envlist.each do |setting|
|
18
|
+
unless (match = /^(\w+)=((.|\n)+)$/.match(setting))
|
19
|
+
warning _("Cannot understand environment setting %{setting}") % { setting: setting.inspect }
|
20
|
+
next
|
21
|
+
end
|
22
|
+
var = match[1]
|
23
|
+
value = match[2]
|
24
|
+
|
25
|
+
if env.include?(var) || env.include?(var.to_sym)
|
26
|
+
warning _("Overriding environment setting '%{var}' with '%{value}'") % { var: var, value: value }
|
20
27
|
end
|
28
|
+
|
29
|
+
env[var] = value
|
21
30
|
end
|
22
31
|
|
23
|
-
|
32
|
+
env
|
33
|
+
end
|
34
|
+
|
35
|
+
def run(command, check = false)
|
36
|
+
output = nil
|
37
|
+
sensitive = resource.parameters[:command].sensitive
|
38
|
+
|
39
|
+
checkexe(command)
|
24
40
|
|
25
41
|
debug "Executing#{check ? " check": ""} '#{sensitive ? '[redacted]' : command}'"
|
26
|
-
begin
|
27
|
-
# Do our chdir
|
28
|
-
Dir.chdir(dir) do
|
29
|
-
environment = {}
|
30
|
-
|
31
|
-
environment[:PATH] = resource[:path].join(File::PATH_SEPARATOR) if resource[:path]
|
32
|
-
|
33
|
-
if envlist = resource[:environment]
|
34
|
-
envlist = [envlist] unless envlist.is_a? Array
|
35
|
-
envlist.each do |setting|
|
36
|
-
if setting =~ /^(\w+)=((.|\n)+)$/
|
37
|
-
env_name = $1
|
38
|
-
value = $2
|
39
|
-
if environment.include?(env_name) || environment.include?(env_name.to_sym)
|
40
|
-
warning _("Overriding environment setting '%{env_name}' with '%{value}'") % { env_name: env_name, value: value }
|
41
|
-
end
|
42
|
-
environment[env_name] = value
|
43
|
-
else
|
44
|
-
warning _("Cannot understand environment setting %{setting}") % { setting: setting.inspect }
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# Ruby 2.1 and later interrupt execution in a way that bypasses error
|
50
|
-
# handling by default. Passing Timeout::Error causes an exception to be
|
51
|
-
# raised that can be rescued inside of the block by cleanup routines.
|
52
|
-
#
|
53
|
-
# This is backwards compatible all the way to Ruby 1.8.7.
|
54
|
-
Timeout::timeout(resource[:timeout], Timeout::Error) do
|
55
|
-
# note that we are passing "false" for the "override_locale" parameter, which ensures that the user's
|
56
|
-
# default/system locale will be respected. Callers may override this behavior by setting locale-related
|
57
|
-
# environment variables (LANG, LC_ALL, etc.) in their 'environment' configuration.
|
58
|
-
output = Puppet::Util::Execution.execute(command, :failonfail => false, :combine => true,
|
59
|
-
:uid => resource[:user], :gid => resource[:group],
|
60
|
-
:override_locale => false,
|
61
|
-
:custom_environment => environment,
|
62
|
-
:sensitive => sensitive)
|
63
|
-
end
|
64
|
-
# The shell returns 127 if the command is missing.
|
65
|
-
if output.exitstatus == 127
|
66
|
-
raise ArgumentError, output
|
67
|
-
end
|
68
42
|
|
69
|
-
|
70
|
-
|
71
|
-
|
43
|
+
# Ruby 2.1 and later interrupt execution in a way that bypasses error
|
44
|
+
# handling by default. Passing Timeout::Error causes an exception to be
|
45
|
+
# raised that can be rescued inside of the block by cleanup routines.
|
46
|
+
#
|
47
|
+
# This is backwards compatible all the way to Ruby 1.8.7.
|
48
|
+
Timeout::timeout(resource[:timeout], Timeout::Error) do
|
49
|
+
cwd = resource[:cwd]
|
50
|
+
cwd ||= Dir.pwd
|
51
|
+
|
52
|
+
# note that we are passing "false" for the "override_locale" parameter, which ensures that the user's
|
53
|
+
# default/system locale will be respected. Callers may override this behavior by setting locale-related
|
54
|
+
# environment variables (LANG, LC_ALL, etc.) in their 'environment' configuration.
|
55
|
+
output = Puppet::Util::Execution.execute(
|
56
|
+
command,
|
57
|
+
:failonfail => false,
|
58
|
+
:combine => true,
|
59
|
+
:cwd => cwd,
|
60
|
+
:uid => resource[:user], :gid => resource[:group],
|
61
|
+
:override_locale => false,
|
62
|
+
:custom_environment => environment(),
|
63
|
+
:sensitive => sensitive
|
64
|
+
)
|
65
|
+
end
|
66
|
+
# The shell returns 127 if the command is missing.
|
67
|
+
if output.exitstatus == 127
|
68
|
+
raise ArgumentError, output
|
72
69
|
end
|
73
70
|
|
74
71
|
# Return output twice as processstatus was returned before, but only exitstatus was ever called.
|
@@ -1,10 +1,6 @@
|
|
1
|
-
#
|
2
1
|
# Group Puppet provider for AIX. It uses standard commands to manage groups:
|
3
2
|
# mkgroup, rmgroup, lsgroup, chgroup
|
4
|
-
|
5
|
-
# Author:: Hector Rivas Gandara <keymon@gmail.com>
|
6
|
-
#
|
7
|
-
require 'puppet/provider/aixobject'
|
3
|
+
require 'puppet/provider/aix_object'
|
8
4
|
|
9
5
|
Puppet::Type.type(:group).provide :aix, :parent => Puppet::Provider::AixObject do
|
10
6
|
desc "Group management for AIX."
|
@@ -13,131 +9,60 @@ Puppet::Type.type(:group).provide :aix, :parent => Puppet::Provider::AixObject d
|
|
13
9
|
defaultfor :operatingsystem => :aix
|
14
10
|
confine :operatingsystem => :aix
|
15
11
|
|
16
|
-
# Provider features
|
17
|
-
has_features :manages_aix_lam
|
18
|
-
has_features :manages_members
|
19
|
-
|
20
12
|
# Commands that manage the element
|
21
13
|
commands :list => "/usr/sbin/lsgroup"
|
22
14
|
commands :add => "/usr/bin/mkgroup"
|
23
15
|
commands :delete => "/usr/sbin/rmgroup"
|
24
16
|
commands :modify => "/usr/bin/chgroup"
|
25
17
|
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
# AIX attributes to properties mapping.
|
32
|
-
#
|
33
|
-
# Valid attributes to be managed by this provider.
|
34
|
-
# It is a list with of hash
|
35
|
-
# :aix_attr AIX command attribute name
|
36
|
-
# :puppet_prop Puppet property name
|
37
|
-
# :to Method to adapt puppet property to aix command value. Optional.
|
38
|
-
# :from Method to adapt aix command value to puppet property. Optional
|
39
|
-
self.attribute_mapping = [
|
40
|
-
#:name => :name,
|
41
|
-
{:aix_attr => :id, :puppet_prop => :gid },
|
42
|
-
{:aix_attr => :users, :puppet_prop => :members,
|
43
|
-
:from => :users_from_attr},
|
44
|
-
{:aix_attr => :attributes, :puppet_prop => :attributes},
|
45
|
-
]
|
46
|
-
|
47
|
-
#--------------
|
48
|
-
# Command definition
|
49
|
-
|
50
|
-
# Return the IA module arguments based on the resource param ia_load_module
|
51
|
-
def get_ia_module_args
|
52
|
-
if @resource[:ia_load_module]
|
53
|
-
["-R", @resource[:ia_load_module].to_s]
|
54
|
-
else
|
55
|
-
[]
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def lscmd(value=@resource[:name])
|
60
|
-
[self.class.command(:list)] +
|
61
|
-
self.get_ia_module_args +
|
62
|
-
[ value]
|
63
|
-
end
|
64
|
-
|
65
|
-
def lsallcmd()
|
66
|
-
lscmd("ALL")
|
67
|
-
end
|
18
|
+
# Provider features
|
19
|
+
has_features :manages_aix_lam
|
20
|
+
has_features :manages_members
|
68
21
|
|
69
|
-
|
70
|
-
#
|
71
|
-
#
|
22
|
+
class << self
|
23
|
+
# Used by the AIX user provider. Returns a hash of:
|
24
|
+
# {
|
25
|
+
# :name => <group_name>,
|
26
|
+
# :gid => <gid>
|
27
|
+
# }
|
72
28
|
#
|
73
|
-
#
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
def deletecmd
|
90
|
-
[self.class.command(:delete)] +
|
91
|
-
self.get_ia_module_args +
|
92
|
-
[@resource[:name]]
|
93
|
-
end
|
94
|
-
|
95
|
-
|
96
|
-
#--------------
|
97
|
-
# Overwrite get_arguments to add the attributes' arguments
|
98
|
-
def get_arguments(key, value, mapping, objectinfo)
|
99
|
-
# In the case of attributes, return a list of key=value
|
100
|
-
if key == :attributes
|
101
|
-
unless value and value.is_a? Hash
|
102
|
-
raise Puppet::Error, _("Attributes must be a list of pairs key=value on %{resource}[%{name}]") %
|
103
|
-
{ resource: @resource.class.name, name: @resource.name }
|
29
|
+
# that matches the group, which can either be the group name or
|
30
|
+
# the gid. Takes an optional set of ia_module_args
|
31
|
+
def find(group, ia_module_args = [])
|
32
|
+
groups = list_all(ia_module_args)
|
33
|
+
|
34
|
+
id_property = mappings[:puppet_property][:id]
|
35
|
+
|
36
|
+
if group.is_a?(String)
|
37
|
+
# Find by name
|
38
|
+
group_hash = groups.find { |cur_group| cur_group[:name] == group }
|
39
|
+
else
|
40
|
+
# Find by gid
|
41
|
+
group_hash = groups.find do |cur_group|
|
42
|
+
id_property.convert_attribute_value(cur_group[:id]) == group
|
43
|
+
end
|
104
44
|
end
|
105
|
-
return value.select { |k,v| true }.map { |pair| pair.join("=") }
|
106
|
-
end
|
107
|
-
super(key, value, mapping, objectinfo)
|
108
|
-
end
|
109
45
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|k,v| !self.class.attribute_mapping_from.include?(k) and
|
114
|
-
!self.class.attribute_ignore.include?(k)
|
115
|
-
}.inject({}) {
|
116
|
-
|h, array| h[array[0]] = array[1]; h
|
117
|
-
}
|
118
|
-
end
|
46
|
+
unless group_hash
|
47
|
+
raise ArgumentError, _("No AIX group exists with a group name or gid of %{group}!") % { group: group }
|
48
|
+
end
|
119
49
|
|
120
|
-
|
121
|
-
|
122
|
-
|
50
|
+
# Convert :id => :gid
|
51
|
+
id = group_hash.delete(:id)
|
52
|
+
group_hash[:gid] = id_property.convert_attribute_value(id)
|
123
53
|
|
124
|
-
|
125
|
-
#self.class.validate(param, value)
|
126
|
-
param = :attributes
|
127
|
-
cmd = modifycmd({param => filter_attributes(attr_hash)})
|
128
|
-
if cmd
|
129
|
-
begin
|
130
|
-
execute(cmd)
|
131
|
-
rescue Puppet::ExecutionFailure => detail
|
132
|
-
raise Puppet::Error, _("Could not set %{param} on %{resource}[%{name}]: %{detail}") % { param: param, resource: @resource.class.name, name: @resource.name, detail: detail }, detail.backtrace
|
133
|
-
end
|
54
|
+
group_hash
|
134
55
|
end
|
135
56
|
end
|
136
57
|
|
137
|
-
|
138
|
-
|
139
|
-
(value.is_a? String) ? value.split(',') : value
|
140
|
-
end
|
58
|
+
mapping puppet_property: :members,
|
59
|
+
aix_attribute: :users
|
141
60
|
|
61
|
+
numeric_mapping puppet_property: :gid,
|
62
|
+
aix_attribute: :id
|
142
63
|
|
64
|
+
# Now that we have all of our mappings, let's go ahead and make
|
65
|
+
# the resource methods (property getters + setters for our mapped
|
66
|
+
# properties + a getter for the attributes property).
|
67
|
+
mk_resource_methods
|
143
68
|
end
|
@@ -9,7 +9,10 @@ Puppet::Type.type(:group).provide :pw, :parent => Puppet::Provider::NameService:
|
|
9
9
|
defaultfor :operatingsystem => [:freebsd, :dragonfly]
|
10
10
|
confine :operatingsystem => [:freebsd, :dragonfly]
|
11
11
|
|
12
|
-
options :members,
|
12
|
+
options :members,
|
13
|
+
:flag => "-M",
|
14
|
+
:method => :mem,
|
15
|
+
:unmunge => proc { |members| members.join(',') }
|
13
16
|
|
14
17
|
verify :gid, _("GID must be an integer") do |value|
|
15
18
|
value.is_a? Integer
|
@@ -26,9 +29,6 @@ Puppet::Type.type(:group).provide :pw, :parent => Puppet::Provider::NameService:
|
|
26
29
|
|
27
30
|
if members = @resource.should(:members)
|
28
31
|
unless members == :absent
|
29
|
-
if members.is_a?(Array)
|
30
|
-
members = members.join(",")
|
31
|
-
end
|
32
32
|
cmd << "-M" << members
|
33
33
|
end
|
34
34
|
end
|
@@ -39,10 +39,6 @@ Puppet::Type.type(:group).provide :pw, :parent => Puppet::Provider::NameService:
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def modifycmd(param, value)
|
42
|
-
# members may be an array, need a comma separated list
|
43
|
-
if param == :members and value.is_a?(Array)
|
44
|
-
value = value.join(",")
|
45
|
-
end
|
46
42
|
super(param, value)
|
47
43
|
end
|
48
44
|
end
|
@@ -22,10 +22,12 @@ Puppet::Type.type(:group).provide :windows_adsi do
|
|
22
22
|
|
23
23
|
# Cannot use munge of the group property to canonicalize @should
|
24
24
|
# since the default array_matching comparison is not commutative
|
25
|
-
|
26
|
-
current_sids = current.map(&:sid)
|
27
25
|
# dupes automatically weeded out when hashes built
|
28
|
-
|
26
|
+
current_members = Puppet::Util::Windows::ADSI::User.name_sid_hash(current)
|
27
|
+
specified_members = Puppet::Util::Windows::ADSI::User.name_sid_hash(should)
|
28
|
+
|
29
|
+
current_sids = current_members.keys.to_a
|
30
|
+
specified_sids = specified_members.keys.to_a
|
29
31
|
|
30
32
|
if @resource[:auth_membership]
|
31
33
|
current_sids.sort == specified_sids.sort
|
@@ -63,7 +65,8 @@ Puppet::Type.type(:group).provide :windows_adsi do
|
|
63
65
|
end
|
64
66
|
|
65
67
|
def members
|
66
|
-
group.members
|
68
|
+
@members ||= Puppet::Util::Windows::ADSI::User.name_sid_hash(group.members)
|
69
|
+
@members.keys
|
67
70
|
end
|
68
71
|
|
69
72
|
def members=(members)
|
@@ -247,31 +247,7 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
247
247
|
# The list of all groups the user is a member of. Different
|
248
248
|
# user mgmt systems will need to override this method.
|
249
249
|
def groups
|
250
|
-
|
251
|
-
|
252
|
-
# Reset our group list
|
253
|
-
Puppet::Etc.setgrent
|
254
|
-
|
255
|
-
user = @resource[:name]
|
256
|
-
|
257
|
-
# Now iterate across all of the groups, adding each one our
|
258
|
-
# user is a member of
|
259
|
-
while group = Puppet::Etc.getgrent
|
260
|
-
members = group.mem
|
261
|
-
|
262
|
-
groups << group.name if members.include? user
|
263
|
-
end
|
264
|
-
|
265
|
-
# We have to close the file, so each listing is a separate
|
266
|
-
# reading of the file.
|
267
|
-
Puppet::Etc.endgrent
|
268
|
-
|
269
|
-
uniq_groups = groups.uniq
|
270
|
-
if groups != uniq_groups
|
271
|
-
debug("Removing any duplicate group entries")
|
272
|
-
end
|
273
|
-
# remove any double listed groups
|
274
|
-
uniq_groups.join(",")
|
250
|
+
Puppet::Util::POSIX.groups_of(@resource[:name]).join(',')
|
275
251
|
end
|
276
252
|
|
277
253
|
# Convert the Etc struct into a hash.
|
@@ -116,7 +116,7 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
|
|
116
116
|
ds_value = input_hash[key]
|
117
117
|
case ds_to_ns_attribute_map[ds_attribute]
|
118
118
|
when :members
|
119
|
-
ds_value = ds_value
|
119
|
+
ds_value = ds_value.join(',')
|
120
120
|
when :gid, :uid
|
121
121
|
# OS X stores objects like uid/gid as strings.
|
122
122
|
# Try casting to an integer for these cases to be
|
@@ -344,8 +344,10 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
|
|
344
344
|
|
345
345
|
def set(param, value)
|
346
346
|
self.class.validate(param, value)
|
347
|
-
current_members = @property_value_cache_hash[:members]
|
348
347
|
if param == :members
|
348
|
+
current_members = @property_value_cache_hash[:members].split(',')
|
349
|
+
value = value.split(',')
|
350
|
+
|
349
351
|
# If we are meant to be authoritative for the group membership
|
350
352
|
# then remove all existing members who haven't been specified
|
351
353
|
# in the manifest.
|
@@ -409,7 +411,7 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
|
|
409
411
|
end
|
410
412
|
if value != "" and not value.nil?
|
411
413
|
if property == :members
|
412
|
-
add_members(nil, value)
|
414
|
+
add_members(nil, value.split(','))
|
413
415
|
else
|
414
416
|
exec_arg_vector = self.class.get_exec_preamble("-create", @resource[:name])
|
415
417
|
exec_arg_vector << ns_to_ds_attribute_map[property.intern]
|
@@ -117,7 +117,7 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
117
117
|
if match
|
118
118
|
result_fields.zip(match.captures) do |field, value|
|
119
119
|
# some fields can be empty or (null) (if we are not passed a category in the package name for instance)
|
120
|
-
if value == '(null)'
|
120
|
+
if value == '(null)' || value == '<unset>'
|
121
121
|
package_info[field] = nil
|
122
122
|
elsif !value or value.empty?
|
123
123
|
package_info[field] = nil
|
@@ -133,7 +133,7 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def qatom_output_format
|
136
|
-
'"[%
|
136
|
+
'"[%[CATEGORY]] [%[PN]] [%[PV]] [%[PR]] [%[SLOT]] [%[pfx]] [%[sfx]]"'
|
137
137
|
end
|
138
138
|
|
139
139
|
def qatom_result_format
|
@@ -63,14 +63,14 @@ Puppet::Type.type(:package).provide(:windows, :parent => Puppet::Provider::Packa
|
|
63
63
|
installer = Puppet::Provider::Package::Windows::Package.installer_class(resource)
|
64
64
|
|
65
65
|
command = [installer.install_command(resource), install_options].flatten.compact.join(' ')
|
66
|
-
output = execute(command, :failonfail => false, :combine => true)
|
66
|
+
output = execute(command, :failonfail => false, :combine => true, :cwd => File.dirname(resource[:source]), :suppress_window => true)
|
67
67
|
|
68
68
|
check_result(output.exitstatus)
|
69
69
|
end
|
70
70
|
|
71
71
|
def uninstall
|
72
72
|
command = [package.uninstall_command, uninstall_options].flatten.compact.join(' ')
|
73
|
-
output = execute(command, :failonfail => false, :combine => true)
|
73
|
+
output = execute(command, :failonfail => false, :combine => true, :suppress_window => true)
|
74
74
|
|
75
75
|
check_result(output.exitstatus)
|
76
76
|
end
|