puppet 6.16.0-x64-mingw32 → 6.17.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.

Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -2
  3. data/Gemfile.lock +10 -10
  4. data/README.md +2 -2
  5. data/lib/puppet/agent.rb +2 -2
  6. data/lib/puppet/application/agent.rb +14 -3
  7. data/lib/puppet/configurer.rb +20 -12
  8. data/lib/puppet/confine.rb +1 -1
  9. data/lib/puppet/defaults.rb +25 -8
  10. data/lib/puppet/file_serving/http_metadata.rb +13 -1
  11. data/lib/puppet/file_serving/metadata.rb +4 -1
  12. data/lib/puppet/file_serving/terminus_selector.rb +7 -8
  13. data/lib/puppet/file_system/file_impl.rb +1 -1
  14. data/lib/puppet/file_system/uniquefile.rb +8 -16
  15. data/lib/puppet/forge.rb +1 -1
  16. data/lib/puppet/forge/cache.rb +1 -1
  17. data/lib/puppet/forge/repository.rb +3 -7
  18. data/lib/puppet/http/client.rb +5 -0
  19. data/lib/puppet/http/redirector.rb +9 -7
  20. data/lib/puppet/http/response.rb +19 -0
  21. data/lib/puppet/indirector.rb +1 -1
  22. data/lib/puppet/indirector/file_content/rest.rb +1 -1
  23. data/lib/puppet/indirector/file_metadata/http.rb +24 -5
  24. data/lib/puppet/indirector/file_metadata/rest.rb +2 -2
  25. data/lib/puppet/indirector/request.rb +1 -1
  26. data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
  27. data/lib/puppet/network/http/api/master/v3/environment.rb +3 -0
  28. data/lib/puppet/network/http/connection_adapter.rb +6 -4
  29. data/lib/puppet/parser/ast/leaf.rb +5 -5
  30. data/lib/puppet/parser/ast/pops_bridge.rb +0 -4
  31. data/lib/puppet/parser/compiler.rb +1 -1
  32. data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +2 -0
  33. data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +2 -0
  34. data/lib/puppet/parser/environment_compiler.rb +4 -1
  35. data/lib/puppet/parser/resource.rb +3 -2
  36. data/lib/puppet/parser/resource/param.rb +6 -0
  37. data/lib/puppet/pops/evaluator/evaluator_impl.rb +5 -5
  38. data/lib/puppet/pops/issues.rb +5 -0
  39. data/lib/puppet/pops/resource/resource_type_impl.rb +2 -0
  40. data/lib/puppet/pops/validation/checker4_0.rb +10 -0
  41. data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
  42. data/lib/puppet/provider/package/aptitude.rb +1 -1
  43. data/lib/puppet/provider/package/yum.rb +1 -1
  44. data/lib/puppet/provider/service/windows.rb +23 -7
  45. data/lib/puppet/provider/user/useradd.rb +11 -4
  46. data/lib/puppet/reports/http.rb +2 -0
  47. data/lib/puppet/resource.rb +2 -1
  48. data/lib/puppet/resource/type.rb +8 -0
  49. data/lib/puppet/ssl/ssl_context.rb +2 -2
  50. data/lib/puppet/ssl/ssl_provider.rb +20 -1
  51. data/lib/puppet/test/test_helper.rb +8 -10
  52. data/lib/puppet/trusted_external.rb +29 -1
  53. data/lib/puppet/type.rb +12 -5
  54. data/lib/puppet/type/file.rb +38 -13
  55. data/lib/puppet/type/file/checksum.rb +4 -4
  56. data/lib/puppet/type/file/source.rb +4 -4
  57. data/lib/puppet/type/service.rb +49 -0
  58. data/lib/puppet/util.rb +39 -15
  59. data/lib/puppet/util/checksums.rb +19 -4
  60. data/lib/puppet/util/fileparsing.rb +2 -2
  61. data/lib/puppet/util/provider_features.rb +1 -1
  62. data/lib/puppet/util/reference.rb +1 -1
  63. data/lib/puppet/util/windows/api_types.rb +45 -32
  64. data/lib/puppet/util/windows/eventlog.rb +1 -6
  65. data/lib/puppet/util/windows/principal.rb +8 -6
  66. data/lib/puppet/util/windows/registry.rb +11 -11
  67. data/lib/puppet/util/windows/service.rb +43 -26
  68. data/lib/puppet/util/windows/user.rb +23 -8
  69. data/lib/puppet/version.rb +1 -1
  70. data/locales/puppet.pot +249 -221
  71. data/man/man5/puppet.conf.5 +19 -8
  72. data/man/man8/puppet-agent.8 +2 -2
  73. data/man/man8/puppet-apply.8 +1 -1
  74. data/man/man8/puppet-catalog.8 +1 -1
  75. data/man/man8/puppet-config.8 +1 -1
  76. data/man/man8/puppet-describe.8 +1 -1
  77. data/man/man8/puppet-device.8 +1 -1
  78. data/man/man8/puppet-doc.8 +1 -1
  79. data/man/man8/puppet-epp.8 +1 -1
  80. data/man/man8/puppet-facts.8 +1 -1
  81. data/man/man8/puppet-filebucket.8 +1 -1
  82. data/man/man8/puppet-generate.8 +1 -1
  83. data/man/man8/puppet-help.8 +1 -1
  84. data/man/man8/puppet-key.8 +1 -1
  85. data/man/man8/puppet-lookup.8 +1 -1
  86. data/man/man8/puppet-man.8 +1 -1
  87. data/man/man8/puppet-module.8 +1 -1
  88. data/man/man8/puppet-node.8 +1 -1
  89. data/man/man8/puppet-parser.8 +1 -1
  90. data/man/man8/puppet-plugin.8 +1 -1
  91. data/man/man8/puppet-report.8 +1 -1
  92. data/man/man8/puppet-resource.8 +1 -1
  93. data/man/man8/puppet-script.8 +1 -1
  94. data/man/man8/puppet-ssl.8 +1 -1
  95. data/man/man8/puppet-status.8 +1 -1
  96. data/man/man8/puppet.8 +2 -2
  97. data/spec/integration/application/agent_spec.rb +89 -0
  98. data/spec/integration/defaults_spec.rb +1 -2
  99. data/spec/integration/network/http_pool_spec.rb +26 -9
  100. data/spec/integration/parser/compiler_spec.rb +11 -0
  101. data/spec/integration/type/file_spec.rb +1 -1
  102. data/spec/integration/util/windows/registry_spec.rb +7 -7
  103. data/spec/integration/util/windows/user_spec.rb +40 -5
  104. data/spec/unit/configurer/fact_handler_spec.rb +4 -4
  105. data/spec/unit/context/trusted_information_spec.rb +10 -4
  106. data/spec/unit/file_serving/http_metadata_spec.rb +37 -14
  107. data/spec/unit/file_serving/terminus_selector_spec.rb +45 -26
  108. data/spec/unit/http/client_spec.rb +64 -8
  109. data/spec/unit/http/response_spec.rb +6 -0
  110. data/spec/unit/indirector/file_metadata/http_spec.rb +27 -0
  111. data/spec/unit/indirector/request_spec.rb +1 -1
  112. data/spec/unit/interface_spec.rb +3 -3
  113. data/spec/unit/network/http/api/indirected_routes_spec.rb +2 -1
  114. data/spec/unit/network/http/connection_spec.rb +42 -32
  115. data/spec/unit/parser/ast/block_expression_spec.rb +1 -1
  116. data/spec/unit/parser/environment_compiler_spec.rb +7 -0
  117. data/spec/unit/parser/scope_spec.rb +1 -1
  118. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +15 -1
  119. data/spec/unit/pops/loaders/loaders_spec.rb +1 -1
  120. data/spec/unit/pops/types/type_calculator_spec.rb +1 -11
  121. data/spec/unit/provider/service/windows_spec.rb +22 -14
  122. data/spec/unit/provider/user/openbsd_spec.rb +1 -0
  123. data/spec/unit/provider/user/useradd_spec.rb +22 -16
  124. data/spec/unit/resource_spec.rb +3 -3
  125. data/spec/unit/ssl/ssl_provider_spec.rb +69 -43
  126. data/spec/unit/test/test_helper_spec.rb +17 -0
  127. data/spec/unit/transaction/report_spec.rb +1 -1
  128. data/spec/unit/type/file/source_spec.rb +3 -3
  129. data/spec/unit/type/file_spec.rb +122 -96
  130. data/spec/unit/type/service_spec.rb +176 -0
  131. data/spec/unit/type_spec.rb +50 -0
  132. data/spec/unit/util/checksums_spec.rb +16 -0
  133. data/spec/unit/util/windows/api_types_spec.rb +104 -40
  134. data/spec/unit/util/windows/service_spec.rb +4 -4
  135. data/spec/unit/util_spec.rb +3 -3
  136. data/spec/unit/x509/cert_provider_spec.rb +1 -1
  137. metadata +5 -5
  138. data/spec/integration/test/test_helper_spec.rb +0 -31
@@ -52,13 +52,7 @@ class Puppet::HTTP::Redirector
52
52
  raise Puppet::HTTP::TooManyRedirects.new(request.uri) if redirects >= @redirect_limit
53
53
 
54
54
  location = parse_location(response)
55
- if location.relative?
56
- url = request.uri.dup
57
- url.path = location.path
58
- else
59
- url = location.dup
60
- end
61
- url.query = request.uri.query
55
+ url = request.uri.merge(location)
62
56
 
63
57
  new_request = request.class.new(url)
64
58
  new_request.body = request.body
@@ -66,6 +60,14 @@ class Puppet::HTTP::Redirector
66
60
  new_request[header] = value
67
61
  end
68
62
 
63
+ # mimic private Net::HTTP#addr_port
64
+ new_request['Host'] = if (location.scheme == 'https' && location.port == 443) ||
65
+ (location.scheme == 'http' && location.port == 80)
66
+ location.host
67
+ else
68
+ "#{location.host}:#{location.port}"
69
+ end
70
+
69
71
  new_request
70
72
  end
71
73
 
@@ -89,11 +89,30 @@ class Puppet::HTTP::Response
89
89
  end
90
90
 
91
91
  # @api private
92
+ #
93
+ # Get a header case-insensitively.
94
+ # @param [String] name The header name
95
+ # @return [String] The header value
96
+ #
92
97
  def [](name)
93
98
  @nethttp[name]
94
99
  end
95
100
 
96
101
  # @api private
102
+ #
103
+ # Yield each header name and value. Returns an enumerator if no block is given.
104
+ #
105
+ # @yieldparam [String] header name
106
+ # @yieldparam [String] header value
107
+ #
108
+ def each_header(&block)
109
+ @nethttp.each_header(&block)
110
+ end
111
+
112
+ # @api private
113
+ #
114
+ # Drain the response body.
115
+ #
97
116
  def drain
98
117
  body
99
118
  true
@@ -46,7 +46,7 @@ module Puppet::Indirector
46
46
 
47
47
  # instantiate the actual Terminus for that type and this name (:ldap, w/ args :node)
48
48
  # & hook the instantiated Terminus into this class (Node: @indirection = terminus)
49
- @indirection = Puppet::Indirector::Indirection.new(self, indirection, options)
49
+ @indirection = Puppet::Indirector::Indirection.new(self, indirection, **options)
50
50
  end
51
51
 
52
52
  module ClassMethods
@@ -18,7 +18,7 @@ class Puppet::Indirector::FileContent::Rest < Puppet::Indirector::REST
18
18
  api = session.route_to(:fileserver, url: url)
19
19
 
20
20
  api.get_file_content(
21
- path: URI.unescape(url.path),
21
+ path: Puppet::Util.uri_unescape(url.path),
22
22
  environment: request.environment.to_s,
23
23
  ) do |data|
24
24
  content << data
@@ -9,19 +9,38 @@ class Puppet::Indirector::FileMetadata::Http < Puppet::Indirector::GenericHttp
9
9
  include Puppet::FileServing::TerminusHelper
10
10
 
11
11
  def find(request)
12
+ checksum_type = request.options[:checksum_type]
12
13
  uri = URI(request.uri)
13
14
  client = Puppet.runtime[:http]
14
15
  head = client.head(uri, options: {include_system_store: true})
15
16
 
16
- if head.success?
17
- metadata = Puppet::FileServing::HttpMetadata.new(head)
18
- metadata.checksum_type = request.options[:checksum_type] if request.options[:checksum_type]
19
- metadata.collect
20
- metadata
17
+ return create_httpmetadata(head, checksum_type) if head.success?
18
+
19
+ case head.code
20
+ when 403, 405
21
+ # AMZ presigned URL and puppetserver may return 403
22
+ # instead of 405. Fallback to partial get
23
+ get = partial_get(client, uri)
24
+ return create_httpmetadata(get, checksum_type) if get.success?
21
25
  end
26
+
27
+ nil
22
28
  end
23
29
 
24
30
  def search(request)
25
31
  raise Puppet::Error, _("cannot lookup multiple files")
26
32
  end
33
+
34
+ private
35
+
36
+ def partial_get(client, uri)
37
+ client.get(uri, headers: {'Range' => 'bytes=0-0'}, options: {include_system_store: true})
38
+ end
39
+
40
+ def create_httpmetadata(http_request, checksum_type)
41
+ metadata = Puppet::FileServing::HttpMetadata.new(http_request)
42
+ metadata.checksum_type = checksum_type if checksum_type
43
+ metadata.collect
44
+ metadata
45
+ end
27
46
  end
@@ -15,7 +15,7 @@ class Puppet::Indirector::FileMetadata::Rest < Puppet::Indirector::REST
15
15
  api = session.route_to(:fileserver, url: url)
16
16
 
17
17
  _, file_metadata = api.get_file_metadata(
18
- path: URI.unescape(url.path),
18
+ path: Puppet::Util.uri_unescape(url.path),
19
19
  environment: request.environment.to_s,
20
20
  links: request.options[:links],
21
21
  checksum_type: request.options[:checksum_type],
@@ -42,7 +42,7 @@ class Puppet::Indirector::FileMetadata::Rest < Puppet::Indirector::REST
42
42
  api = session.route_to(:fileserver, url: url)
43
43
 
44
44
  _, file_metadatas = api.get_file_metadatas(
45
- path: URI.unescape(url.path),
45
+ path: Puppet::Util.uri_unescape(url.path),
46
46
  environment: request.environment.to_s,
47
47
  recurse: request.options[:recurse],
48
48
  recurselimit: request.options[:recurselimit],
@@ -290,6 +290,6 @@ class Puppet::Indirector::Request
290
290
  @protocol = uri.scheme
291
291
  end
292
292
 
293
- @key = URI.unescape(uri.path.sub(/^\//, ''))
293
+ @key = Puppet::Util.uri_unescape(uri.path.sub(/^\//, ''))
294
294
  end
295
295
  end
@@ -218,7 +218,7 @@ class Puppet::Network::HTTP::API::IndirectedRoutes
218
218
  return formatter if formatter
219
219
 
220
220
  raise Puppet::Network::HTTP::Error::HTTPNotAcceptableError.new(
221
- _("No supported formats are acceptable (Accept: %{accepted_formats})") % { accepted_formats: formats },
221
+ _("No supported formats are acceptable (Accept: %{accepted_formats})") % { accepted_formats: formats.map(&:mime).join(', ') },
222
222
  Puppet::Network::HTTP::Issues::UNSUPPORTED_FORMAT)
223
223
  end
224
224
 
@@ -1,8 +1,11 @@
1
1
  require 'puppet/util/json'
2
2
  require 'puppet/parser/environment_compiler'
3
3
 
4
+ # @deprecated application orchestration will be removed in puppet 7
4
5
  class Puppet::Network::HTTP::API::Master::V3::Environment
5
6
  def call(request, response)
7
+ Puppet.deprecation_warning("Application orchestration is deprecated. See https://puppet.com/docs/puppet/5.5/deprecated_language.html")
8
+
6
9
  env_name = request.routing_path.split('/').last
7
10
  env = Puppet.lookup(:environments).get(env_name)
8
11
  code_id = request.params[:code_id]
@@ -149,12 +149,14 @@ class Puppet::Network::HTTP::ConnectionAdapter < Puppet::Network::HTTP::Connecti
149
149
  # though clients are only supposed to send them to proxies, so the proxy knows
150
150
  # what upstream server to CONNECT to. This method creates a URL using the
151
151
  # scheme/host/port that the connection was created with, and appends the path
152
- # portion of the absolute-form. The resulting request will use "origin-form"
152
+ # and query portions of the absolute-form. The resulting request will use "origin-form"
153
153
  # as it should have done all along.
154
- url = URI(path)
155
- URI("#{@site.addr}/#{normalize_path(url.path)}")
154
+ abs_form = URI(path)
155
+ url = URI("#{@site.addr}/#{normalize_path(abs_form.path)}")
156
+ url.query = abs_form.query if abs_form.query
157
+ url
156
158
  else
157
- URI("#{@site.addr}/#{Puppet::Util.uri_encode(normalize_path(path))}")
159
+ URI("#{@site.addr}/#{normalize_path(path)}")
158
160
  end
159
161
  end
160
162
 
@@ -17,17 +17,17 @@ class Puppet::Parser::AST::Leaf < Puppet::Parser::AST
17
17
  @value.to_s unless @value.nil?
18
18
  end
19
19
 
20
- def initialize(value: nil, **options)
20
+ def initialize(value: nil, file: nil, line: nil, pos: nil)
21
21
  @value = value
22
- super(**options)
22
+ super(file: file, line: line, pos: pos)
23
23
  end
24
24
  end
25
25
 
26
26
  # Host names, either fully qualified or just the short name, or even a regex
27
27
  #
28
28
  class Puppet::Parser::AST::HostName < Puppet::Parser::AST::Leaf
29
- def initialize(hash)
30
- super
29
+ def initialize(value: nil, file: nil, line: nil, pos: nil)
30
+ super(value: value, file: file, line: line, pos: pos)
31
31
 
32
32
  # Note that this is an AST::Regex, not a Regexp
33
33
  unless @value.is_a?(Regex)
@@ -51,7 +51,7 @@ end
51
51
 
52
52
  class Puppet::Parser::AST::Regex < Puppet::Parser::AST::Leaf
53
53
  def initialize(hash)
54
- super
54
+ super(**hash)
55
55
  # transform value from hash options unless it is already a regular expression
56
56
  @value = Regexp.new(@value) unless @value.is_a?(Regexp)
57
57
  end
@@ -57,10 +57,6 @@ class Puppet::Parser::AST::PopsBridge
57
57
  end
58
58
 
59
59
  class ExpressionSupportingReturn < Expression
60
- def initialize args
61
- super
62
- end
63
-
64
60
  def evaluate(scope)
65
61
  return catch(:return) do
66
62
  return catch(:next) do
@@ -448,7 +448,7 @@ class Puppet::Parser::Compiler
448
448
  # using the top scope.
449
449
  def newscope(parent, options = {})
450
450
  parent ||= topscope
451
- scope = Puppet::Parser::Scope.new(self, options)
451
+ scope = Puppet::Parser::Scope.new(self, **options)
452
452
  scope.parent = parent
453
453
  scope
454
454
  end
@@ -1,6 +1,8 @@
1
1
  class Puppet::Parser::Compiler
2
2
  # Validator that asserts that all capability resources that are referenced by 'consume' or 'require' has
3
3
  # been exported by some other resource in the environment
4
+ #
5
+ # @deprecated application orchestration will be removed in puppet 7
4
6
  class CatalogValidator::EnvironmentRelationshipValidator < CatalogValidator
5
7
 
6
8
  def validate
@@ -1,5 +1,7 @@
1
1
  class Puppet::Parser::Compiler
2
2
  # Validator that asserts that only application components can appear inside a site.
3
+ #
4
+ # @deprecated application orchestration will be removed in puppet 7
3
5
  class CatalogValidator::SiteValidator < CatalogValidator
4
6
  def self.validation_stage?(stage)
5
7
  PRE_FINISH.equal?(stage)
@@ -1,5 +1,6 @@
1
1
  require 'puppet/parser/compiler'
2
2
 
3
+ # @deprecated application orchestration will be removed in puppet 7
3
4
  class Puppet::Parser::EnvironmentCompiler < Puppet::Parser::Compiler
4
5
  def self.compile(env, code_id=nil)
5
6
  begin
@@ -16,7 +17,7 @@ class Puppet::Parser::EnvironmentCompiler < Puppet::Parser::Compiler
16
17
  end
17
18
 
18
19
  def initialize(node, options = {})
19
- super
20
+ super(node, **options)
20
21
  @overridden_functions = {}
21
22
  end
22
23
 
@@ -54,6 +55,8 @@ class Puppet::Parser::EnvironmentCompiler < Puppet::Parser::Compiler
54
55
  end
55
56
 
56
57
  def compile
58
+ Puppet.deprecation_warning("Application orchestration is deprecated. See https://puppet.com/docs/puppet/5.5/deprecated_language.html")
59
+
57
60
  add_function_overrides
58
61
  begin
59
62
  Puppet.override(@context_overrides, _("For compiling environment catalog %{env}") % { env: environment.name }) do
@@ -338,10 +338,11 @@ class Puppet::Parser::Resource < Puppet::Resource
338
338
  end
339
339
 
340
340
  def replace_sensitive_data
341
- parameters.each_pair do |name, param|
341
+ parameters.keys.each do |name|
342
+ param = parameters[name]
342
343
  if param.value.is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive)
343
344
  @sensitive_parameters << name
344
- param.value = param.value.unwrap
345
+ parameters[name] = Puppet::Parser::Resource::Param.from_param(param, param.value.unwrap)
345
346
  end
346
347
  end
347
348
  end
@@ -26,4 +26,10 @@ class Puppet::Parser::Resource::Param
26
26
  def to_s
27
27
  "#{self.name} => #{self.value}"
28
28
  end
29
+
30
+ def self.from_param(param, value)
31
+ new_param = param.dup
32
+ new_param.value = value
33
+ return new_param
34
+ end
29
35
  end
@@ -876,11 +876,11 @@ class EvaluatorImpl
876
876
  def eval_ApplyExpression(o, scope)
877
877
  # All expressions are wrapped in an ApplyBlockExpression so we can identify the contents of
878
878
  # that block. However we don't want to serialize the block expression, so unwrap here.
879
- body = if o.body.statements.count > 1
880
- Model::BlockExpression.from_asserted_hash(o.body._pcore_init_hash)
881
- else
882
- o.body.statements[0]
883
- end
879
+ body = if o.body.statements.count == 1
880
+ o.body.statements[0]
881
+ else
882
+ Model::BlockExpression.from_asserted_hash(o.body._pcore_init_hash)
883
+ end
884
884
 
885
885
  Puppet.lookup(:apply_executor).apply(unfold([], o.arguments, scope), body, scope)
886
886
  end
@@ -920,5 +920,10 @@ module Issues
920
920
  LOADER_FAILURE = issue :LOADER_FAILURE, :type do
921
921
  _('Failed to load: %{type_name}') % { type: type }
922
922
  end
923
+
924
+ DEPRECATED_APP_ORCHESTRATION = issue :DEPRECATED_APP_ORCHESTRATION, :klass do
925
+ _("Use of the application-orchestration %{expr} is deprecated. See https://puppet.com/docs/puppet/5.5/deprecated_language.html" % { expr: label(klass) })
926
+ end
927
+
923
928
  end
924
929
  end
@@ -248,6 +248,8 @@ class ResourceTypeImpl
248
248
  #######################
249
249
 
250
250
  # Applications are not supported
251
+ #
252
+ # @deprecated application orchestration will be removed in puppet 7
251
253
  def application?
252
254
  false
253
255
  end
@@ -199,6 +199,11 @@ class Checker4_0 < Evaluator::LiteralEvaluator
199
199
  end
200
200
  end
201
201
 
202
+ def check_Application(o)
203
+ check_NamedDefinition(o)
204
+ acceptor.accept(Issues::DEPRECATED_APP_ORCHESTRATION, o, {:klass => o})
205
+ end
206
+
202
207
  def check_AssignmentExpression(o)
203
208
  case o.operator
204
209
  when '='
@@ -296,6 +301,7 @@ class Checker4_0 < Evaluator::LiteralEvaluator
296
301
  end
297
302
 
298
303
  def check_CapabilityMapping(o)
304
+ acceptor.accept(Issues::DEPRECATED_APP_ORCHESTRATION, o, {:klass => o})
299
305
  ok =
300
306
  case o.component
301
307
  when Model::QualifiedReference
@@ -865,6 +871,10 @@ class Checker4_0 < Evaluator::LiteralEvaluator
865
871
  rvalue(o.matching_expr)
866
872
  end
867
873
 
874
+ def check_SiteDefinition(o)
875
+ acceptor.accept(Issues::DEPRECATED_APP_ORCHESTRATION, o, {:klass => o})
876
+ end
877
+
868
878
  def check_UnaryExpression(o)
869
879
  rvalue(o.expr)
870
880
  end
@@ -31,6 +31,7 @@ class ValidatorFactory_4_0 < Factory
31
31
  p[Issues::RT_NO_STORECONFIGS] = Puppet[:storeconfigs] ? :ignore : :warning
32
32
 
33
33
  p[Issues::FUTURE_RESERVED_WORD] = :deprecation
34
+ p[Issues::DEPRECATED_APP_ORCHESTRATION] = :deprecation
34
35
 
35
36
  p[Issues::DUPLICATE_KEY] = Puppet[:strict] == :off ? :ignore : Puppet[:strict]
36
37
  p[Issues::NAME_WITH_HYPHEN] = :error
@@ -16,7 +16,7 @@ Puppet::Type.type(:package).provide :aptitude, :parent => :apt, :source => :dpkg
16
16
  output = aptitude(*args)
17
17
 
18
18
  # Yay, stupid aptitude doesn't throw an error when the package is missing.
19
- if args.include?(:install) and output =~ /Couldn't find any package/
19
+ if args.include?(:install) and output.to_s =~ /Couldn't find any package/
20
20
  raise Puppet::Error.new(
21
21
  _("Could not find package %{name}") % { name: self.name }
22
22
  )
@@ -302,7 +302,7 @@ defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a
302
302
  command = [command(:cmd)] + no_debug + ["-e", error_level, "-y", install_options, operation, wanted].compact
303
303
  output = execute(command)
304
304
 
305
- if output =~ /^No package #{wanted} available\.$/
305
+ if output.to_s =~ /^No package #{wanted} available\.$/
306
306
  raise Puppet::Error, _("Could not find package %{wanted}") % { wanted: wanted }
307
307
  end
308
308
 
@@ -14,29 +14,28 @@ Puppet::Type.type(:service).provide :windows, :parent => :service do
14
14
  defaultfor :operatingsystem => :windows
15
15
  confine :operatingsystem => :windows
16
16
 
17
- has_feature :refreshable
18
- has_feature :configurable_timeout
17
+ has_feature :refreshable, :configurable_timeout, :manages_logon_credentials
19
18
 
20
19
  def enable
21
- Puppet::Util::Windows::Service.set_startup_mode( @resource[:name], :SERVICE_AUTO_START )
20
+ Puppet::Util::Windows::Service.set_startup_configuration(@resource[:name], options: {startup_type: :SERVICE_AUTO_START})
22
21
  rescue => detail
23
22
  raise Puppet::Error.new(_("Cannot enable %{resource_name}, error was: %{detail}") % { resource_name: @resource[:name], detail: detail }, detail )
24
23
  end
25
24
 
26
25
  def disable
27
- Puppet::Util::Windows::Service.set_startup_mode( @resource[:name], :SERVICE_DISABLED )
26
+ Puppet::Util::Windows::Service.set_startup_configuration(@resource[:name], options: {startup_type: :SERVICE_DISABLED})
28
27
  rescue => detail
29
28
  raise Puppet::Error.new(_("Cannot disable %{resource_name}, error was: %{detail}") % { resource_name: @resource[:name], detail: detail }, detail )
30
29
  end
31
30
 
32
31
  def manual_start
33
- Puppet::Util::Windows::Service.set_startup_mode( @resource[:name], :SERVICE_DEMAND_START )
32
+ Puppet::Util::Windows::Service.set_startup_configuration(@resource[:name], options: {startup_type: :SERVICE_DEMAND_START})
34
33
  rescue => detail
35
34
  raise Puppet::Error.new(_("Cannot enable %{resource_name} for manual start, error was: %{detail}") % { resource_name: @resource[:name], detail: detail }, detail )
36
35
  end
37
36
 
38
37
  def delayed_start
39
- Puppet::Util::Windows::Service.set_startup_mode( @resource[:name], :SERVICE_AUTO_START, true )
38
+ Puppet::Util::Windows::Service.set_startup_configuration(@resource[:name], options: {startup_type: :SERVICE_AUTO_START, delayed: true})
40
39
  rescue => detail
41
40
  raise Puppet::Error.new(_("Cannot enable %{resource_name} for delayed start, error was: %{detail}") % { resource_name: @resource[:name], detail: detail }, detail )
42
41
  end
@@ -110,7 +109,10 @@ Puppet::Type.type(:service).provide :windows, :parent => :service do
110
109
  raise Puppet::Error.new(_("Unknown service state '%{current_state}' for service '%{resource_name}'") % { current_state: current_state, resource_name: @resource[:name] })
111
110
  end
112
111
  debug("Service #{@resource[:name]} is #{current_state}")
113
- return state
112
+ state
113
+ rescue => detail
114
+ Puppet.warning("Status for service #{@resource[:name]} could not be retrieved: #{detail}")
115
+ :stopped
114
116
  end
115
117
 
116
118
  def default_timeout
@@ -125,4 +127,18 @@ Puppet::Type.type(:service).provide :windows, :parent => :service do
125
127
  end
126
128
  services
127
129
  end
130
+
131
+ def logonaccount
132
+ return unless Puppet::Util::Windows::Service.exists?(@resource[:name])
133
+ Puppet::Util::Windows::Service.logon_account(@resource[:name])
134
+ end
135
+
136
+ def logonaccount=(value)
137
+ Puppet::Util::Windows::Service.set_startup_configuration(@resource[:name], options: {logon_account: value, logon_password: @resource[:logonpassword]})
138
+ restart if @resource[:ensure] == :running && [:running, :paused].include?(status)
139
+ end
140
+
141
+ def logonpassword=(value)
142
+ Puppet::Util::Windows::Service.set_startup_configuration(@resource[:name], options: {logon_password: value})
143
+ end
128
144
  end