puppet 6.19.1-x64-mingw32 → 6.23.0-x64-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/CODEOWNERS +2 -16
- data/Gemfile +3 -1
- data/Gemfile.lock +51 -40
- data/ext/osx/puppet.plist +2 -0
- data/ext/project_data.yaml +2 -2
- data/lib/puppet/application.rb +10 -6
- data/lib/puppet/application/agent.rb +12 -4
- data/lib/puppet/application/apply.rb +4 -2
- data/lib/puppet/application/device.rb +2 -0
- data/lib/puppet/application/filebucket.rb +2 -2
- data/lib/puppet/application/resource.rb +2 -1
- data/lib/puppet/application/script.rb +2 -0
- data/lib/puppet/application/ssl.rb +11 -0
- data/lib/puppet/application_support.rb +7 -0
- data/lib/puppet/configurer.rb +28 -18
- data/lib/puppet/configurer/downloader.rb +2 -1
- data/lib/puppet/defaults.rb +51 -23
- data/lib/puppet/environments.rb +54 -55
- data/lib/puppet/face/config.rb +10 -0
- data/lib/puppet/face/epp.rb +12 -2
- data/lib/puppet/face/facts.rb +158 -0
- data/lib/puppet/ffi/posix.rb +10 -0
- data/lib/puppet/ffi/posix/constants.rb +14 -0
- data/lib/puppet/ffi/posix/functions.rb +24 -0
- data/lib/puppet/file_serving/fileset.rb +14 -2
- data/lib/puppet/file_system/memory_file.rb +8 -1
- data/lib/puppet/file_system/windows.rb +2 -0
- data/lib/puppet/functions/all.rb +1 -1
- data/lib/puppet/functions/camelcase.rb +1 -1
- data/lib/puppet/functions/capitalize.rb +2 -2
- data/lib/puppet/functions/downcase.rb +2 -2
- data/lib/puppet/functions/epp.rb +1 -0
- data/lib/puppet/functions/get.rb +5 -5
- data/lib/puppet/functions/group_by.rb +13 -5
- data/lib/puppet/functions/inline_epp.rb +1 -0
- data/lib/puppet/functions/lest.rb +1 -1
- data/lib/puppet/functions/new.rb +100 -100
- data/lib/puppet/functions/partition.rb +12 -4
- data/lib/puppet/functions/require.rb +5 -5
- data/lib/puppet/functions/sort.rb +3 -3
- data/lib/puppet/functions/tree_each.rb +7 -9
- data/lib/puppet/functions/type.rb +4 -4
- data/lib/puppet/functions/upcase.rb +2 -2
- data/lib/puppet/http/resolver/server_list.rb +15 -4
- data/lib/puppet/http/service/compiler.rb +69 -0
- data/lib/puppet/http/service/file_server.rb +2 -1
- data/lib/puppet/indirector/catalog/compiler.rb +1 -0
- data/lib/puppet/indirector/fact_search.rb +60 -0
- data/lib/puppet/indirector/facts/facter.rb +24 -3
- data/lib/puppet/indirector/facts/json.rb +27 -0
- data/lib/puppet/indirector/facts/yaml.rb +3 -58
- data/lib/puppet/indirector/file_metadata/rest.rb +1 -0
- data/lib/puppet/indirector/json.rb +5 -1
- data/lib/puppet/indirector/node/json.rb +8 -0
- data/lib/puppet/indirector/report/json.rb +34 -0
- data/lib/puppet/module_tool/applications/installer.rb +48 -2
- data/lib/puppet/module_tool/errors/shared.rb +17 -2
- data/lib/puppet/network/formats.rb +69 -1
- data/lib/puppet/network/http/factory.rb +4 -0
- data/lib/puppet/pal/pal_impl.rb +70 -17
- data/lib/puppet/parser/ast/leaf.rb +3 -2
- data/lib/puppet/parser/functions/fqdn_rand.rb +14 -6
- data/lib/puppet/parser/templatewrapper.rb +1 -1
- data/lib/puppet/pops/evaluator/deferred_resolver.rb +5 -3
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +22 -3
- data/lib/puppet/pops/model/ast_transformer.rb +1 -1
- data/lib/puppet/pops/types/p_sem_ver_type.rb +8 -2
- data/lib/puppet/pops/types/p_sensitive_type.rb +10 -0
- data/lib/puppet/property/list.rb +1 -1
- data/lib/puppet/provider/group/groupadd.rb +13 -8
- data/lib/puppet/provider/package/apt.rb +34 -2
- data/lib/puppet/provider/package/aptitude.rb +6 -0
- data/lib/puppet/provider/package/dnfmodule.rb +1 -1
- data/lib/puppet/provider/package/nim.rb +11 -6
- data/lib/puppet/provider/service/debian.rb +2 -0
- data/lib/puppet/provider/service/systemd.rb +14 -4
- data/lib/puppet/provider/service/windows.rb +38 -0
- data/lib/puppet/provider/user/aix.rb +2 -2
- data/lib/puppet/provider/user/directoryservice.rb +25 -12
- data/lib/puppet/provider/user/useradd.rb +62 -8
- data/lib/puppet/reference/configuration.rb +7 -6
- data/lib/puppet/settings.rb +33 -28
- data/lib/puppet/settings/alias_setting.rb +37 -0
- data/lib/puppet/settings/base_setting.rb +26 -2
- data/lib/puppet/settings/environment_conf.rb +1 -0
- data/lib/puppet/transaction/additional_resource_generator.rb +1 -1
- data/lib/puppet/type/file.rb +19 -1
- data/lib/puppet/type/file/selcontext.rb +1 -1
- data/lib/puppet/type/package.rb +3 -3
- data/lib/puppet/type/service.rb +18 -38
- data/lib/puppet/type/tidy.rb +21 -2
- data/lib/puppet/type/user.rb +38 -20
- data/lib/puppet/util/autoload.rb +1 -8
- data/lib/puppet/util/fact_dif.rb +81 -0
- data/lib/puppet/util/monkey_patches.rb +7 -0
- data/lib/puppet/util/posix.rb +54 -5
- data/lib/puppet/util/rubygems.rb +5 -1
- data/lib/puppet/util/selinux.rb +30 -4
- data/lib/puppet/util/windows/adsi.rb +46 -0
- data/lib/puppet/util/windows/api_types.rb +1 -1
- data/lib/puppet/util/windows/principal.rb +9 -2
- data/lib/puppet/util/windows/service.rb +1 -1
- data/lib/puppet/util/windows/sid.rb +4 -2
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +372 -288
- data/man/man5/puppet.conf.5 +282 -254
- data/man/man8/puppet-agent.8 +2 -2
- data/man/man8/puppet-apply.8 +2 -2
- data/man/man8/puppet-catalog.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 +2 -2
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +90 -1
- data/man/man8/puppet-filebucket.8 +3 -3
- 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-module.8 +1 -1
- data/man/man8/puppet-node.8 +4 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +4 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +2 -2
- data/man/man8/puppet-ssl.8 +5 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +91 -0
- data/spec/fixtures/ssl/127.0.0.1-key.pem +107 -57
- data/spec/fixtures/ssl/127.0.0.1.pem +52 -31
- data/spec/fixtures/ssl/bad-basic-constraints.pem +57 -35
- data/spec/fixtures/ssl/bad-int-basic-constraints.pem +57 -35
- data/spec/fixtures/ssl/ca.pem +57 -35
- data/spec/fixtures/ssl/crl.pem +28 -18
- data/spec/fixtures/ssl/ec-key.pem +11 -11
- data/spec/fixtures/ssl/ec.pem +33 -24
- data/spec/fixtures/ssl/encrypted-ec-key.pem +12 -12
- data/spec/fixtures/ssl/encrypted-key.pem +108 -58
- data/spec/fixtures/ssl/intermediate-agent-crl.pem +28 -19
- data/spec/fixtures/ssl/intermediate-agent.pem +57 -36
- data/spec/fixtures/ssl/intermediate-crl.pem +31 -21
- data/spec/fixtures/ssl/intermediate.pem +57 -36
- data/spec/fixtures/ssl/pluto-key.pem +107 -57
- data/spec/fixtures/ssl/pluto.pem +52 -30
- data/spec/fixtures/ssl/request-key.pem +107 -57
- data/spec/fixtures/ssl/request.pem +47 -26
- data/spec/fixtures/ssl/revoked-key.pem +107 -57
- data/spec/fixtures/ssl/revoked.pem +52 -30
- data/spec/fixtures/ssl/signed-key.pem +107 -57
- data/spec/fixtures/ssl/signed.pem +52 -30
- data/spec/fixtures/ssl/tampered-cert.pem +52 -30
- data/spec/fixtures/ssl/tampered-csr.pem +47 -26
- data/spec/fixtures/ssl/unknown-127.0.0.1-key.pem +107 -57
- data/spec/fixtures/ssl/unknown-127.0.0.1.pem +50 -29
- data/spec/fixtures/ssl/unknown-ca-key.pem +107 -57
- data/spec/fixtures/ssl/unknown-ca.pem +55 -33
- data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services_vendor_preset +9 -0
- data/spec/fixtures/unit/provider/user/aix/aix_passwd_file.out +4 -0
- data/spec/integration/application/agent_spec.rb +160 -3
- data/spec/integration/application/apply_spec.rb +19 -0
- data/spec/integration/application/plugin_spec.rb +1 -1
- data/spec/integration/application/resource_spec.rb +30 -0
- data/spec/integration/defaults_spec.rb +0 -7
- data/spec/integration/environments/setting_hooks_spec.rb +1 -1
- data/spec/integration/http/client_spec.rb +12 -0
- data/spec/integration/indirector/direct_file_server_spec.rb +1 -3
- data/spec/integration/resource/type_collection_spec.rb +2 -6
- data/spec/integration/transaction_spec.rb +4 -9
- data/spec/integration/util/windows/adsi_spec.rb +21 -1
- data/spec/integration/util/windows/principal_spec.rb +21 -0
- data/spec/integration/util/windows/registry_spec.rb +6 -10
- data/spec/lib/puppet/test_ca.rb +2 -2
- data/spec/lib/puppet_spec/settings.rb +6 -1
- data/spec/spec_helper.rb +12 -5
- data/spec/unit/agent_spec.rb +8 -6
- data/spec/unit/application/agent_spec.rb +7 -3
- data/spec/unit/application/config_spec.rb +224 -4
- data/spec/unit/application/facts_spec.rb +482 -3
- data/spec/unit/application/filebucket_spec.rb +0 -2
- data/spec/unit/application/ssl_spec.rb +23 -0
- data/spec/unit/application_spec.rb +51 -9
- data/spec/unit/configurer/downloader_spec.rb +6 -0
- data/spec/unit/configurer_spec.rb +23 -0
- data/spec/unit/confine/feature_spec.rb +1 -1
- data/spec/unit/confine_spec.rb +8 -2
- data/spec/unit/defaults_spec.rb +36 -1
- data/spec/unit/environments_spec.rb +221 -68
- data/spec/unit/face/config_spec.rb +27 -32
- data/spec/unit/face/facts_spec.rb +4 -0
- data/spec/unit/face/node_spec.rb +0 -11
- data/spec/unit/file_serving/configuration/parser_spec.rb +0 -1
- data/spec/unit/file_serving/fileset_spec.rb +60 -0
- data/spec/unit/file_serving/metadata_spec.rb +3 -3
- data/spec/unit/file_serving/terminus_helper_spec.rb +11 -4
- data/spec/unit/file_system_spec.rb +9 -0
- data/spec/unit/forge/module_release_spec.rb +2 -7
- data/spec/unit/functions/inline_epp_spec.rb +26 -1
- data/spec/unit/gettext/config_spec.rb +12 -0
- data/spec/unit/http/service/compiler_spec.rb +172 -0
- data/spec/unit/http/service_spec.rb +1 -1
- data/spec/unit/indirector/catalog/compiler_spec.rb +14 -10
- data/spec/unit/indirector/face_spec.rb +0 -1
- data/spec/unit/indirector/facts/facter_spec.rb +95 -1
- data/spec/unit/indirector/facts/json_spec.rb +255 -0
- data/spec/unit/indirector/file_bucket_file/selector_spec.rb +26 -8
- data/spec/unit/indirector/indirection_spec.rb +8 -12
- data/spec/unit/indirector/key/file_spec.rb +0 -1
- data/spec/unit/indirector/node/json_spec.rb +33 -0
- data/spec/{integration/indirector/report/yaml.rb → unit/indirector/report/json_spec.rb} +13 -24
- data/spec/unit/indirector/report/yaml_spec.rb +72 -8
- data/spec/unit/indirector_spec.rb +2 -2
- data/spec/unit/module_tool/applications/installer_spec.rb +66 -0
- data/spec/unit/network/authconfig_spec.rb +0 -3
- data/spec/unit/network/formats_spec.rb +41 -0
- data/spec/unit/network/http/api/indirected_routes_spec.rb +0 -9
- data/spec/unit/network/http/factory_spec.rb +19 -0
- data/spec/unit/network/http/handler_spec.rb +0 -5
- data/spec/unit/parser/compiler_spec.rb +3 -19
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +15 -1
- data/spec/unit/parser/resource_spec.rb +14 -8
- data/spec/unit/parser/templatewrapper_spec.rb +4 -3
- data/spec/unit/pops/evaluator/deferred_resolver_spec.rb +20 -0
- data/spec/unit/pops/types/p_sem_ver_type_spec.rb +18 -0
- data/spec/unit/pops/types/p_sensitive_type_spec.rb +18 -0
- data/spec/unit/property_spec.rb +1 -0
- data/spec/unit/provider/group/groupadd_spec.rb +5 -2
- data/spec/unit/provider/nameservice_spec.rb +66 -65
- data/spec/unit/provider/package/apt_spec.rb +28 -23
- data/spec/unit/provider/package/aptitude_spec.rb +1 -1
- data/spec/unit/provider/package/base_spec.rb +6 -5
- data/spec/unit/provider/package/dnfmodule_spec.rb +10 -1
- data/spec/unit/provider/package/nim_spec.rb +42 -0
- data/spec/unit/provider/package/pacman_spec.rb +18 -12
- data/spec/unit/provider/package/pip_spec.rb +6 -11
- data/spec/unit/provider/package/pkgdmg_spec.rb +0 -4
- data/spec/unit/provider/service/init_spec.rb +1 -0
- data/spec/unit/provider/service/openwrt_spec.rb +3 -1
- data/spec/unit/provider/service/systemd_spec.rb +53 -8
- data/spec/unit/provider/service/windows_spec.rb +202 -0
- data/spec/unit/provider/user/aix_spec.rb +5 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +67 -35
- data/spec/unit/provider/user/hpux_spec.rb +1 -1
- data/spec/unit/provider/user/pw_spec.rb +2 -0
- data/spec/unit/provider/user/useradd_spec.rb +71 -3
- data/spec/unit/provider_spec.rb +8 -10
- data/spec/unit/puppet_pal_catalog_spec.rb +45 -0
- data/spec/unit/resource/capability_finder_spec.rb +6 -1
- data/spec/unit/resource/catalog_spec.rb +1 -1
- data/spec/unit/resource/type_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +11 -10
- data/spec/unit/settings_spec.rb +419 -242
- data/spec/unit/ssl/base_spec.rb +0 -1
- data/spec/unit/ssl/host_spec.rb +0 -5
- data/spec/unit/ssl/ssl_provider_spec.rb +14 -8
- data/spec/unit/ssl/state_machine_spec.rb +19 -5
- data/spec/unit/transaction/additional_resource_generator_spec.rb +3 -9
- data/spec/unit/transaction/event_manager_spec.rb +14 -11
- data/spec/unit/transaction_spec.rb +18 -11
- data/spec/unit/type/file/content_spec.rb +0 -1
- data/spec/unit/type/file/selinux_spec.rb +3 -5
- data/spec/unit/type/file_spec.rb +0 -6
- data/spec/unit/type/group_spec.rb +13 -6
- data/spec/unit/type/resources_spec.rb +7 -7
- data/spec/unit/type/service_spec.rb +60 -189
- data/spec/unit/type/tidy_spec.rb +17 -8
- data/spec/unit/type/user_spec.rb +45 -0
- data/spec/unit/type_spec.rb +2 -2
- data/spec/unit/util/at_fork_spec.rb +2 -2
- data/spec/unit/util/autoload_spec.rb +5 -1
- data/spec/unit/util/backups_spec.rb +1 -2
- data/spec/unit/util/execution_spec.rb +15 -11
- data/spec/unit/util/inifile_spec.rb +6 -14
- data/spec/unit/util/log_spec.rb +8 -7
- data/spec/unit/util/logging_spec.rb +3 -3
- data/spec/unit/util/posix_spec.rb +363 -15
- data/spec/unit/util/rubygems_spec.rb +2 -2
- data/spec/unit/util/selinux_spec.rb +163 -68
- data/spec/unit/util/storage_spec.rb +3 -1
- data/spec/unit/util/suidmanager_spec.rb +44 -41
- data/spec/unit/util/windows/sid_spec.rb +6 -0
- data/spec/unit/util_spec.rb +13 -6
- data/tasks/generate_cert_fixtures.rake +2 -2
- metadata +33 -16
- data/spec/integration/application/config_spec.rb +0 -74
- data/spec/lib/matchers/include.rb +0 -27
- data/spec/lib/matchers/include_spec.rb +0 -32
- data/spec/unit/face/catalog_spec.rb +0 -6
- data/spec/unit/face/module_spec.rb +0 -3
@@ -59,23 +59,37 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
|
|
59
59
|
get(:uid)
|
60
60
|
end
|
61
61
|
|
62
|
+
def gid
|
63
|
+
return localgid if @resource.forcelocal?
|
64
|
+
get(:gid)
|
65
|
+
end
|
66
|
+
|
62
67
|
def comment
|
63
68
|
return localcomment if @resource.forcelocal?
|
64
69
|
get(:comment)
|
65
70
|
end
|
66
71
|
|
72
|
+
def groups
|
73
|
+
return localgroups if @resource.forcelocal?
|
74
|
+
super
|
75
|
+
end
|
76
|
+
|
67
77
|
def finduser(key, value)
|
68
|
-
passwd_file =
|
78
|
+
passwd_file = '/etc/passwd'
|
69
79
|
passwd_keys = [:account, :password, :uid, :gid, :gecos, :directory, :shell]
|
70
|
-
|
71
|
-
@
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
80
|
+
|
81
|
+
unless @users
|
82
|
+
unless Puppet::FileSystem.exist?(passwd_file)
|
83
|
+
raise Puppet::Error.new("Forcelocal set for user resource '#{resource[:name]}', but #{passwd_file} does not exist")
|
84
|
+
end
|
85
|
+
|
86
|
+
@users = []
|
87
|
+
Puppet::FileSystem.each_line(passwd_file) do |line|
|
88
|
+
user = line.chomp.split(':')
|
89
|
+
@users << Hash[passwd_keys.zip(user)]
|
76
90
|
end
|
77
91
|
end
|
78
|
-
false
|
92
|
+
@users.find { |param| param[key] == value } || false
|
79
93
|
end
|
80
94
|
|
81
95
|
def local_username
|
@@ -88,16 +102,56 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
|
|
88
102
|
false
|
89
103
|
end
|
90
104
|
|
105
|
+
def localgid
|
106
|
+
user = finduser(:account, resource[:name])
|
107
|
+
if user
|
108
|
+
begin
|
109
|
+
return Integer(user[:gid])
|
110
|
+
rescue ArgumentError
|
111
|
+
Puppet.debug("Non-numeric GID found in /etc/passwd for user #{resource[:name]}")
|
112
|
+
return user[:gid]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
false
|
116
|
+
end
|
117
|
+
|
91
118
|
def localcomment
|
92
119
|
user = finduser(:account, resource[:name])
|
93
120
|
user[:gecos]
|
94
121
|
end
|
95
122
|
|
123
|
+
def localgroups
|
124
|
+
@groups_of ||= {}
|
125
|
+
group_file = '/etc/group'
|
126
|
+
user = resource[:name]
|
127
|
+
|
128
|
+
return @groups_of[user] if @groups_of[user]
|
129
|
+
|
130
|
+
@groups_of[user] = []
|
131
|
+
|
132
|
+
unless Puppet::FileSystem.exist?(group_file)
|
133
|
+
raise Puppet::Error.new("Forcelocal set for user resource '#{user}', but #{group_file} does not exist")
|
134
|
+
end
|
135
|
+
|
136
|
+
Puppet::FileSystem.each_line(group_file) do |line|
|
137
|
+
data = line.chomp.split(':')
|
138
|
+
if !data.empty? && data.last.split(',').include?(user)
|
139
|
+
@groups_of[user] << data.first
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
@groups_of[user]
|
144
|
+
end
|
145
|
+
|
96
146
|
def shell=(value)
|
97
147
|
check_valid_shell
|
98
148
|
set(:shell, value)
|
99
149
|
end
|
100
150
|
|
151
|
+
def groups=(value)
|
152
|
+
set(:groups, value)
|
153
|
+
end
|
154
|
+
|
101
155
|
verify :gid, "GID must be an integer" do |value|
|
102
156
|
value.is_a? Integer
|
103
157
|
end
|
@@ -41,7 +41,7 @@ config = Puppet::Util::Reference.newreference(:configuration, :depth => 1, :doc
|
|
41
41
|
# Leave out the section information; it was apparently confusing people.
|
42
42
|
#str << "- **Section**: #{object.section}\n"
|
43
43
|
unless val == ""
|
44
|
-
str << "- *Default*:
|
44
|
+
str << "- *Default*: `#{val}`\n"
|
45
45
|
end
|
46
46
|
str << "\n"
|
47
47
|
end
|
@@ -55,11 +55,12 @@ config.header = <<EOT
|
|
55
55
|
* Each of these settings can be specified in `puppet.conf` or on the
|
56
56
|
command line.
|
57
57
|
* Puppet Enterprise (PE) and open source Puppet share the configuration settings
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
documented here. However, PE defaults differ from open source defaults for some
|
59
|
+
settings, such as `node_terminus`, `storeconfigs`, `always_retry_plugins`,
|
60
|
+
`disable18n`, `environment_timeout` (when Code Manager is enabled), and the
|
61
|
+
Puppet Server JRuby `max-active-instances` setting. To verify PE configuration
|
62
|
+
defaults, check the `puppet.conf` or `pe-puppet-server.conf` file after
|
63
|
+
installation.
|
63
64
|
* When using boolean settings on the command line, use `--setting` and
|
64
65
|
`--no-setting` instead of `--setting (true|false)`. (Using `--setting false`
|
65
66
|
results in "Error: Could not parse application options: needless argument".)
|
data/lib/puppet/settings.rb
CHANGED
@@ -32,6 +32,7 @@ class Puppet::Settings
|
|
32
32
|
require 'puppet/settings/server_list_setting'
|
33
33
|
require 'puppet/settings/http_extra_headers_setting'
|
34
34
|
require 'puppet/settings/certificate_revocation_setting'
|
35
|
+
require 'puppet/settings/alias_setting'
|
35
36
|
|
36
37
|
# local reference for convenience
|
37
38
|
PuppetOptionParser = Puppet::Util::CommandLine::PuppetOptionParser
|
@@ -385,19 +386,6 @@ class Puppet::Settings
|
|
385
386
|
call_hooks_deferred_to_application_initialization
|
386
387
|
issue_deprecations
|
387
388
|
|
388
|
-
run_mode = Puppet::Util::RunMode[self.preferred_run_mode]
|
389
|
-
if run_mode.agent? || run_mode.server?
|
390
|
-
if self.set_in_section?(:masterport, run_mode.name) && !self.set_in_section?(:serverport, run_mode.name)
|
391
|
-
self[:serverport] = self[:masterport]
|
392
|
-
elsif self.set_by_config?(:masterport) && !self.set_by_config?(:serverport)
|
393
|
-
self[:serverport] = self[:masterport]
|
394
|
-
elsif self.set_in_section?(:serverport, run_mode.name) && !self.set_in_section?(:masterport, run_mode.name)
|
395
|
-
self[:masterport] = self[:serverport]
|
396
|
-
elsif self.set_by_config?(:serverport) && !self.set_by_config?(:masterport)
|
397
|
-
self[:masterport] = self[:serverport]
|
398
|
-
end
|
399
|
-
end
|
400
|
-
|
401
389
|
REQUIRED_APP_SETTINGS.each do |key|
|
402
390
|
create_ancestors(Puppet[key])
|
403
391
|
end
|
@@ -742,7 +730,8 @@ class Puppet::Settings
|
|
742
730
|
:autosign => AutosignSetting,
|
743
731
|
:server_list => ServerListSetting,
|
744
732
|
:http_extra_headers => HttpExtraHeadersSetting,
|
745
|
-
:certificate_revocation => CertificateRevocationSetting
|
733
|
+
:certificate_revocation => CertificateRevocationSetting,
|
734
|
+
:alias => AliasSetting
|
746
735
|
}
|
747
736
|
|
748
737
|
# Create a new setting. The value is passed in because it's used to determine
|
@@ -1273,27 +1262,37 @@ Generated on #{Time.now}.
|
|
1273
1262
|
end
|
1274
1263
|
|
1275
1264
|
def add_environment_resources(catalog, sections)
|
1276
|
-
path = self[:environmentpath]
|
1277
|
-
envdir = path.split(File::PATH_SEPARATOR).first if path
|
1278
1265
|
configured_environment = self[:environment]
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1266
|
+
|
1267
|
+
if configured_environment == "production" && !production_environment_exists?
|
1268
|
+
environment_path = self[:environmentpath]
|
1269
|
+
first_environment_path = environment_path.split(File::PATH_SEPARATOR).first
|
1270
|
+
|
1271
|
+
if Puppet::FileSystem.exist?(first_environment_path)
|
1272
|
+
production_environment_path = File.join(first_environment_path, configured_environment)
|
1284
1273
|
parameters = { :ensure => 'directory' }
|
1285
|
-
|
1286
|
-
|
1287
|
-
if
|
1288
|
-
|
1289
|
-
parameters[:group] = Puppet[:group] if service_group_available?
|
1290
|
-
end
|
1274
|
+
parameters[:mode] = '0750'
|
1275
|
+
if Puppet.features.root?
|
1276
|
+
parameters[:owner] = Puppet[:user] if service_user_available?
|
1277
|
+
parameters[:group] = Puppet[:group] if service_group_available?
|
1291
1278
|
end
|
1292
|
-
catalog.add_resource(Puppet::Resource.new(:file,
|
1279
|
+
catalog.add_resource(Puppet::Resource.new(:file, production_environment_path, :parameters => parameters))
|
1293
1280
|
end
|
1294
1281
|
end
|
1295
1282
|
end
|
1296
1283
|
|
1284
|
+
def production_environment_exists?
|
1285
|
+
environment_path = self[:environmentpath]
|
1286
|
+
paths = environment_path.split(File::PATH_SEPARATOR)
|
1287
|
+
|
1288
|
+
paths.any? do |path|
|
1289
|
+
# If expected_path is a symlink, assume the source path is being managed
|
1290
|
+
# elsewhere, so accept it also as a valid production environment path
|
1291
|
+
expected_path = File.join(path, 'production')
|
1292
|
+
Puppet::FileSystem.directory?(expected_path) || Puppet::FileSystem.symlink?(expected_path)
|
1293
|
+
end
|
1294
|
+
end
|
1295
|
+
|
1297
1296
|
def add_user_resources(catalog, sections)
|
1298
1297
|
return unless Puppet.features.root?
|
1299
1298
|
return if Puppet::Util::Platform.windows?
|
@@ -1394,6 +1393,12 @@ Generated on #{Time.now}.
|
|
1394
1393
|
end
|
1395
1394
|
end
|
1396
1395
|
|
1396
|
+
setting = @defaults[name]
|
1397
|
+
if setting.respond_to?(:alias_name)
|
1398
|
+
val = lookup(setting.alias_name)
|
1399
|
+
return val if val
|
1400
|
+
end
|
1401
|
+
|
1397
1402
|
@defaults[name].default
|
1398
1403
|
end
|
1399
1404
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class Puppet::Settings::AliasSetting
|
2
|
+
attr_reader :name, :alias_name
|
3
|
+
|
4
|
+
def initialize(args = {})
|
5
|
+
@name = args[:name]
|
6
|
+
@alias_name = args[:alias_for]
|
7
|
+
@alias_for = Puppet.settings.setting(alias_name)
|
8
|
+
end
|
9
|
+
|
10
|
+
def optparse_args
|
11
|
+
args = @alias_for.optparse_args
|
12
|
+
args[0].gsub!(alias_name.to_s, name.to_s)
|
13
|
+
args
|
14
|
+
end
|
15
|
+
|
16
|
+
def getopt_args
|
17
|
+
args = @alias_for.getopt_args
|
18
|
+
args[0].gsub!(alias_name.to_s, name.to_s)
|
19
|
+
args
|
20
|
+
end
|
21
|
+
|
22
|
+
def type
|
23
|
+
:alias
|
24
|
+
end
|
25
|
+
|
26
|
+
def method_missing(method, *args)
|
27
|
+
begin
|
28
|
+
alias_for.send(method, *args)
|
29
|
+
rescue => e
|
30
|
+
Puppet.log_exception(self.class, e.message)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :alias_for
|
37
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'set'
|
1
2
|
require 'puppet/settings/errors'
|
2
3
|
|
3
4
|
# The base setting type
|
@@ -5,27 +6,50 @@ class Puppet::Settings::BaseSetting
|
|
5
6
|
attr_accessor :name, :desc, :section, :default, :call_hook
|
6
7
|
attr_reader :short, :deprecated
|
7
8
|
|
9
|
+
# Hooks are called during different parts of the settings lifecycle:
|
10
|
+
#
|
11
|
+
# * :on_write_only - This is the default hook type. The hook will be called
|
12
|
+
# if its value is set in `main` or programmatically. If its value is set in
|
13
|
+
# a section that doesn't match the application's run mode, it will be
|
14
|
+
# ignored entirely. If the section does match the run mode, the value will
|
15
|
+
# be used, but the hook will not be called!
|
16
|
+
#
|
17
|
+
# * :on_define_and_write - The hook behaves the same as above, except it is
|
18
|
+
# also called immediately when the setting is defined in
|
19
|
+
# {Puppet::Settings.define_settings}. In that case, the hook receives the
|
20
|
+
# default value as specified.
|
21
|
+
#
|
22
|
+
# * :on_initialize_and_write - The hook will be called if the value is set in
|
23
|
+
# `main`, the section that matches the run mode, or programmatically.
|
24
|
+
#
|
25
|
+
HOOK_TYPES = Set.new([:on_define_and_write, :on_initialize_and_write, :on_write_only]).freeze
|
26
|
+
|
8
27
|
def self.available_call_hook_values
|
9
|
-
|
28
|
+
HOOK_TYPES.to_a
|
10
29
|
end
|
11
30
|
|
31
|
+
# Registers a hook to be called later based on the type of hook specified in `value`.
|
32
|
+
#
|
33
|
+
# @param value [Symbol] One of {HOOK_TYPES}
|
12
34
|
def call_hook=(value)
|
13
35
|
if value.nil?
|
14
36
|
#TRANSLATORS ':%{name}', ':call_hook', and ':on_write_only' should not be translated
|
15
37
|
Puppet.warning _("Setting :%{name} :call_hook is nil, defaulting to :on_write_only") % { name: name }
|
16
38
|
value = :on_write_only
|
17
39
|
end
|
18
|
-
unless
|
40
|
+
unless HOOK_TYPES.include?(value)
|
19
41
|
#TRANSLATORS 'call_hook' is a Puppet option name and should not be translated
|
20
42
|
raise ArgumentError, _("Invalid option %{value} for call_hook") % { value: value }
|
21
43
|
end
|
22
44
|
@call_hook = value
|
23
45
|
end
|
24
46
|
|
47
|
+
# @see {HOOK_TYPES}
|
25
48
|
def call_hook_on_define?
|
26
49
|
call_hook == :on_define_and_write
|
27
50
|
end
|
28
51
|
|
52
|
+
# @see {HOOK_TYPES}
|
29
53
|
def call_hook_on_initialize?
|
30
54
|
call_hook == :on_initialize_and_write
|
31
55
|
end
|
@@ -29,6 +29,7 @@ class Puppet::Settings::EnvironmentConf
|
|
29
29
|
section = config.sections[:main]
|
30
30
|
rescue Errno::ENOENT
|
31
31
|
# environment.conf is an optional file
|
32
|
+
Puppet.debug { "Path to #{path_to_env} does not exist, using default environment.conf" }
|
32
33
|
end
|
33
34
|
|
34
35
|
new(path_to_env, section, global_module_path)
|
@@ -137,7 +137,7 @@ class Puppet::Transaction::AdditionalResourceGenerator
|
|
137
137
|
else
|
138
138
|
@catalog.add_resource_after(parent_resource, res)
|
139
139
|
end
|
140
|
-
@catalog.add_edge(@catalog.container_of(parent_resource), res)
|
140
|
+
@catalog.add_edge(@catalog.container_of(parent_resource), res) if @catalog.container_of(parent_resource)
|
141
141
|
if @relationship_graph && priority
|
142
142
|
# If we have a relationship_graph we should add the resource
|
143
143
|
# to it (this is an eval_generate). If we don't, then the
|
data/lib/puppet/type/file.rb
CHANGED
@@ -220,6 +220,23 @@ Puppet::Type.newtype(:file) do
|
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
+
newparam(:max_files) do
|
224
|
+
desc "In case the resource is a directory and the recursion is enabled, puppet will
|
225
|
+
generate a new resource for each file file found, possible leading to
|
226
|
+
an excessive number of resources generated without any control.
|
227
|
+
|
228
|
+
Setting `max_files` will check the number of file resources that
|
229
|
+
will eventually be created and will raise a resource argument error if the
|
230
|
+
limit will be exceeded.
|
231
|
+
|
232
|
+
Use value `0` to log a warning instead of raising an error.
|
233
|
+
|
234
|
+
Use value `-1` to disable errors and warnings due to max files."
|
235
|
+
|
236
|
+
defaultto 0
|
237
|
+
newvalues(/^[0-9]+$/, /^-1$/)
|
238
|
+
end
|
239
|
+
|
223
240
|
newparam(:replace, :boolean => true, :parent => Puppet::Parameter::Boolean) do
|
224
241
|
desc "Whether to replace a file or symlink that already exists on the local system but
|
225
242
|
whose content doesn't match what the `source` or `content` attribute
|
@@ -576,7 +593,7 @@ Puppet::Type.newtype(:file) do
|
|
576
593
|
options = @original_parameters.merge(:path => full_path).reject { |param, value| value.nil? }
|
577
594
|
|
578
595
|
# These should never be passed to our children.
|
579
|
-
[:parent, :ensure, :recurse, :recurselimit, :target, :alias, :source].each do |param|
|
596
|
+
[:parent, :ensure, :recurse, :recurselimit, :max_files, :target, :alias, :source].each do |param|
|
580
597
|
options.delete(param) if options.include?(param)
|
581
598
|
end
|
582
599
|
|
@@ -753,6 +770,7 @@ Puppet::Type.newtype(:file) do
|
|
753
770
|
:links => self[:links],
|
754
771
|
:recurse => (self[:recurse] == :remote ? true : self[:recurse]),
|
755
772
|
:recurselimit => self[:recurselimit],
|
773
|
+
:max_files => self[:max_files],
|
756
774
|
:source_permissions => self[:source_permissions],
|
757
775
|
:ignore => self[:ignore],
|
758
776
|
:checksum_type => (self[:source] || self[:content]) ? self[:checksum] : :none,
|
data/lib/puppet/type/package.rb
CHANGED
@@ -426,10 +426,10 @@ module Puppet
|
|
426
426
|
end
|
427
427
|
|
428
428
|
newparam(:source) do
|
429
|
-
desc "Where to find the package file. This is
|
429
|
+
desc "Where to find the package file. This is mostly used by providers that don't
|
430
430
|
automatically download packages from a central repository. (For example:
|
431
|
-
the `yum`
|
432
|
-
`dpkg` providers require it.)
|
431
|
+
the `yum` provider ignores this attribute, `apt` provider uses it if present
|
432
|
+
and the `rpm` and `dpkg` providers require it.)
|
433
433
|
|
434
434
|
Different providers accept different values for `source`. Most providers
|
435
435
|
accept paths to local files stored on the target system. Some providers
|
data/lib/puppet/type/service.rb
CHANGED
@@ -38,6 +38,12 @@ module Puppet
|
|
38
38
|
feature :enableable, "The provider can enable and disable the service.",
|
39
39
|
:methods => [:disable, :enable, :enabled?]
|
40
40
|
|
41
|
+
feature :delayed_startable, "The provider can set service to delayed start",
|
42
|
+
:methods => [:delayed_start]
|
43
|
+
|
44
|
+
feature :manual_startable, "The provider can set service to manual start",
|
45
|
+
:methods => [:manual_start]
|
46
|
+
|
41
47
|
feature :controllable, "The provider uses a control variable."
|
42
48
|
|
43
49
|
feature :flaggable, "The provider can pass flags to the service."
|
@@ -67,7 +73,7 @@ module Puppet
|
|
67
73
|
provider.disable
|
68
74
|
end
|
69
75
|
|
70
|
-
newvalue(:manual, :event => :service_manual_start) do
|
76
|
+
newvalue(:manual, :event => :service_manual_start, :required_features => :manual_startable) do
|
71
77
|
provider.manual_start
|
72
78
|
end
|
73
79
|
|
@@ -81,8 +87,7 @@ module Puppet
|
|
81
87
|
provider.enabled?
|
82
88
|
end
|
83
89
|
|
84
|
-
|
85
|
-
newvalue(:delayed, :event => :service_delayed_start) do
|
90
|
+
newvalue(:delayed, :event => :service_delayed_start, :required_features => :delayed_startable) do
|
86
91
|
provider.delayed_start
|
87
92
|
end
|
88
93
|
|
@@ -90,12 +95,6 @@ module Puppet
|
|
90
95
|
return provider.enabled_insync?(current) if provider.respond_to?(:enabled_insync?)
|
91
96
|
super(current)
|
92
97
|
end
|
93
|
-
|
94
|
-
validate do |value|
|
95
|
-
if (value == :manual || value == :delayed) && !Puppet::Util::Platform.windows?
|
96
|
-
raise Puppet::Error.new(_("Setting enable to %{value} is only supported on Microsoft Windows.") % { value: value.to_s} )
|
97
|
-
end
|
98
|
-
end
|
99
98
|
end
|
100
99
|
|
101
100
|
# Handle whether the service should actually be running right now.
|
@@ -139,23 +138,9 @@ module Puppet
|
|
139
138
|
newproperty(:logonaccount, :required_features => :manages_logon_credentials) do
|
140
139
|
desc "Specify an account for service logon"
|
141
140
|
|
142
|
-
|
143
|
-
return
|
144
|
-
|
145
|
-
|
146
|
-
value.sub!(/^\.\\/, "#{Puppet::Util::Windows::ADSI.computer_name}\\")
|
147
|
-
user_information = Puppet::Util::Windows::SID.name_to_principal(value)
|
148
|
-
raise Puppet::Error.new("\"#{value}\" is not a valid account") unless user_information && [:SidTypeUser, :SidTypeWellKnownGroup].include?(user_information.account_type)
|
149
|
-
|
150
|
-
user_rights = Puppet::Util::Windows::User::get_rights(user_information.domain_account) unless Puppet::Util::Windows::User::default_system_account?(value)
|
151
|
-
raise Puppet::Error.new("\"#{user_information.domain_account}\" has the 'Log On As A Service' right set to denied.") if user_rights =~ /SeDenyServiceLogonRight/
|
152
|
-
raise Puppet::Error.new("\"#{user_information.domain_account}\" is missing the 'Log On As A Service' right.") unless user_rights.nil? || user_rights =~ /SeServiceLogonRight/
|
153
|
-
|
154
|
-
if user_information.domain == Puppet::Util::Windows::ADSI.computer_name
|
155
|
-
".\\#{user_information.account}"
|
156
|
-
else
|
157
|
-
user_information.domain_account
|
158
|
-
end
|
141
|
+
def insync?(current)
|
142
|
+
return provider.logonaccount_insync?(current) if provider.respond_to?(:logonaccount_insync?)
|
143
|
+
super(current)
|
159
144
|
end
|
160
145
|
end
|
161
146
|
|
@@ -163,18 +148,7 @@ module Puppet
|
|
163
148
|
desc "Specify a password for service logon. Default value is an empty string (when logonaccount is specified)."
|
164
149
|
|
165
150
|
validate do |value|
|
166
|
-
raise
|
167
|
-
raise ArgumentError, _("Passwords cannot include ':'") if value.is_a?(String) and value.include?(":")
|
168
|
-
return unless Puppet::Util::Platform.windows?
|
169
|
-
|
170
|
-
is_a_predefined_local_account = Puppet::Util::Windows::User::default_system_account?(@resource[:logonaccount]) || @resource[:logonaccount] == 'LocalSystem'
|
171
|
-
|
172
|
-
account_info = @resource[:logonaccount].split("\\")
|
173
|
-
able_to_logon = Puppet::Util::Windows::User.password_is?(account_info[1], value, account_info[0]) unless is_a_predefined_local_account
|
174
|
-
|
175
|
-
raise Puppet::Error.new("The given password is invalid for user '#{@resource[:logonaccount]}'.") unless is_a_predefined_local_account || able_to_logon
|
176
|
-
|
177
|
-
provider.logonpassword=(value)
|
151
|
+
raise ArgumentError, _("Passwords cannot include ':'") if value.is_a?(String) && value.include?(":")
|
178
152
|
end
|
179
153
|
|
180
154
|
sensitive true
|
@@ -320,5 +294,11 @@ module Puppet
|
|
320
294
|
def self.needs_ensure_retrieved
|
321
295
|
false
|
322
296
|
end
|
297
|
+
|
298
|
+
validate do
|
299
|
+
if @parameters[:logonpassword] && @parameters[:logonaccount].nil?
|
300
|
+
raise Puppet::Error.new(_"The 'logonaccount' parameter is mandatory when setting 'logonpassword'.")
|
301
|
+
end
|
302
|
+
end
|
323
303
|
end
|
324
304
|
end
|