puppet 7.0.0-universal-darwin → 7.5.0-universal-darwin

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 (191) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +2 -16
  3. data/Gemfile +2 -3
  4. data/Gemfile.lock +45 -33
  5. data/ext/build_defaults.yaml +0 -1
  6. data/ext/project_data.yaml +1 -0
  7. data/lib/puppet/application.rb +10 -6
  8. data/lib/puppet/application/agent.rb +1 -0
  9. data/lib/puppet/application/apply.rb +3 -2
  10. data/lib/puppet/application/device.rb +1 -0
  11. data/lib/puppet/application/script.rb +1 -0
  12. data/lib/puppet/application/ssl.rb +11 -0
  13. data/lib/puppet/application_support.rb +7 -0
  14. data/lib/puppet/configurer.rb +16 -3
  15. data/lib/puppet/defaults.rb +14 -41
  16. data/lib/puppet/environments.rb +54 -55
  17. data/lib/puppet/face/facts.rb +26 -2
  18. data/lib/puppet/face/node/clean.rb +8 -0
  19. data/lib/puppet/ffi/posix.rb +10 -0
  20. data/lib/puppet/ffi/posix/constants.rb +14 -0
  21. data/lib/puppet/ffi/posix/functions.rb +24 -0
  22. data/lib/puppet/ffi/windows/api_types.rb +1 -1
  23. data/lib/puppet/ffi/windows/constants.rb +1 -1
  24. data/lib/puppet/file_serving/configuration/parser.rb +5 -2
  25. data/lib/puppet/file_system/memory_file.rb +8 -1
  26. data/lib/puppet/file_system/windows.rb +2 -0
  27. data/lib/puppet/http/factory.rb +4 -0
  28. data/lib/puppet/indirector/facts/facter.rb +1 -0
  29. data/lib/puppet/module_tool/applications/installer.rb +48 -2
  30. data/lib/puppet/module_tool/errors/shared.rb +17 -2
  31. data/lib/puppet/network/formats.rb +67 -0
  32. data/lib/puppet/network/http.rb +5 -2
  33. data/lib/puppet/network/http/api.rb +10 -6
  34. data/lib/puppet/network/http/api/master.rb +3 -2
  35. data/lib/puppet/network/http/api/master/v3.rb +2 -25
  36. data/lib/puppet/network/http/api/master/v3/environments.rb +2 -33
  37. data/lib/puppet/network/http/api/server.rb +10 -0
  38. data/lib/puppet/network/http/api/server/v3.rb +39 -0
  39. data/lib/puppet/network/http/api/server/v3/environments.rb +48 -0
  40. data/lib/puppet/parser/ast/leaf.rb +3 -2
  41. data/lib/puppet/parser/templatewrapper.rb +1 -1
  42. data/lib/puppet/pops/evaluator/deferred_resolver.rb +5 -3
  43. data/lib/puppet/pops/model/ast_transformer.rb +1 -1
  44. data/lib/puppet/pops/parser/lexer2.rb +0 -4
  45. data/lib/puppet/pops/validation/checker4_0.rb +0 -1
  46. data/lib/puppet/property/list.rb +1 -1
  47. data/lib/puppet/provider/group/groupadd.rb +13 -8
  48. data/lib/puppet/provider/package/apt.rb +34 -2
  49. data/lib/puppet/provider/package/aptitude.rb +6 -0
  50. data/lib/puppet/provider/service/debian.rb +2 -0
  51. data/lib/puppet/provider/user/aix.rb +2 -2
  52. data/lib/puppet/provider/user/useradd.rb +62 -8
  53. data/lib/puppet/reference/configuration.rb +6 -5
  54. data/lib/puppet/settings.rb +33 -28
  55. data/lib/puppet/settings/alias_setting.rb +37 -0
  56. data/lib/puppet/settings/environment_conf.rb +1 -0
  57. data/lib/puppet/type/package.rb +3 -3
  58. data/lib/puppet/type/user.rb +1 -1
  59. data/lib/puppet/util/autoload.rb +1 -8
  60. data/lib/puppet/util/monkey_patches.rb +7 -0
  61. data/lib/puppet/util/posix.rb +54 -5
  62. data/lib/puppet/util/windows/adsi.rb +46 -0
  63. data/lib/puppet/util/windows/principal.rb +9 -2
  64. data/lib/puppet/util/windows/sid.rb +4 -2
  65. data/lib/puppet/version.rb +1 -1
  66. data/locales/puppet.pot +166 -146
  67. data/man/man5/puppet.conf.5 +14 -6
  68. data/man/man8/puppet-agent.8 +2 -2
  69. data/man/man8/puppet-apply.8 +2 -2
  70. data/man/man8/puppet-catalog.8 +1 -1
  71. data/man/man8/puppet-config.8 +1 -1
  72. data/man/man8/puppet-describe.8 +1 -1
  73. data/man/man8/puppet-device.8 +2 -2
  74. data/man/man8/puppet-doc.8 +1 -1
  75. data/man/man8/puppet-epp.8 +1 -1
  76. data/man/man8/puppet-facts.8 +8 -2
  77. data/man/man8/puppet-filebucket.8 +1 -1
  78. data/man/man8/puppet-generate.8 +1 -1
  79. data/man/man8/puppet-help.8 +1 -1
  80. data/man/man8/puppet-lookup.8 +1 -1
  81. data/man/man8/puppet-module.8 +1 -1
  82. data/man/man8/puppet-node.8 +1 -1
  83. data/man/man8/puppet-parser.8 +1 -1
  84. data/man/man8/puppet-plugin.8 +1 -1
  85. data/man/man8/puppet-report.8 +1 -1
  86. data/man/man8/puppet-resource.8 +1 -1
  87. data/man/man8/puppet-script.8 +2 -2
  88. data/man/man8/puppet-ssl.8 +5 -1
  89. data/man/man8/puppet.8 +2 -2
  90. data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +91 -0
  91. data/spec/fixtures/unit/provider/user/aix/aix_passwd_file.out +4 -0
  92. data/spec/integration/application/agent_spec.rb +160 -3
  93. data/spec/integration/application/apply_spec.rb +19 -0
  94. data/spec/integration/application/plugin_spec.rb +1 -1
  95. data/spec/integration/defaults_spec.rb +0 -7
  96. data/spec/integration/http/client_spec.rb +12 -0
  97. data/spec/integration/indirector/direct_file_server_spec.rb +1 -3
  98. data/spec/integration/indirector/file_content/file_server_spec.rb +0 -2
  99. data/spec/integration/indirector/file_metadata/file_server_spec.rb +0 -2
  100. data/spec/integration/parser/collection_spec.rb +10 -0
  101. data/spec/integration/resource/type_collection_spec.rb +2 -6
  102. data/spec/integration/transaction_spec.rb +4 -9
  103. data/spec/integration/util/windows/adsi_spec.rb +21 -1
  104. data/spec/integration/util/windows/principal_spec.rb +21 -0
  105. data/spec/integration/util/windows/registry_spec.rb +6 -10
  106. data/spec/spec_helper.rb +1 -4
  107. data/spec/unit/agent_spec.rb +8 -6
  108. data/spec/unit/application/agent_spec.rb +0 -1
  109. data/spec/unit/application/facts_spec.rb +58 -7
  110. data/spec/unit/application/filebucket_spec.rb +0 -2
  111. data/spec/unit/application/ssl_spec.rb +23 -0
  112. data/spec/unit/application_spec.rb +51 -9
  113. data/spec/unit/confine/feature_spec.rb +1 -1
  114. data/spec/unit/confine_spec.rb +8 -2
  115. data/spec/unit/defaults_spec.rb +1 -56
  116. data/spec/unit/environments_spec.rb +221 -68
  117. data/spec/unit/face/node_spec.rb +14 -13
  118. data/spec/unit/file_serving/configuration/parser_spec.rb +8 -1
  119. data/spec/unit/file_serving/metadata_spec.rb +3 -3
  120. data/spec/unit/file_serving/terminus_helper_spec.rb +11 -4
  121. data/spec/unit/file_system_spec.rb +9 -0
  122. data/spec/unit/forge/module_release_spec.rb +2 -7
  123. data/spec/unit/http/factory_spec.rb +19 -0
  124. data/spec/unit/indirector/face_spec.rb +0 -1
  125. data/spec/unit/indirector/facts/facter_spec.rb +20 -5
  126. data/spec/unit/indirector/file_bucket_file/selector_spec.rb +26 -8
  127. data/spec/unit/indirector/indirection_spec.rb +8 -12
  128. data/spec/unit/indirector_spec.rb +2 -2
  129. data/spec/unit/module_tool/applications/installer_spec.rb +66 -0
  130. data/spec/unit/network/formats_spec.rb +41 -0
  131. data/spec/unit/network/http/api/indirected_routes_spec.rb +0 -4
  132. data/spec/unit/network/http/api/master_spec.rb +38 -0
  133. data/spec/unit/network/http/api/{master → server}/v3/environments_spec.rb +2 -2
  134. data/spec/unit/network/http/api/{master → server}/v3_spec.rb +19 -19
  135. data/spec/unit/network/http/api_spec.rb +11 -11
  136. data/spec/unit/parser/compiler_spec.rb +3 -19
  137. data/spec/unit/parser/resource_spec.rb +14 -8
  138. data/spec/unit/parser/templatewrapper_spec.rb +4 -3
  139. data/spec/unit/pops/evaluator/deferred_resolver_spec.rb +20 -0
  140. data/spec/unit/pops/parser/lexer2_spec.rb +0 -4
  141. data/spec/unit/pops/validator/validator_spec.rb +20 -43
  142. data/spec/unit/property_spec.rb +1 -0
  143. data/spec/unit/provider/group/groupadd_spec.rb +5 -2
  144. data/spec/unit/provider/nameservice_spec.rb +66 -65
  145. data/spec/unit/provider/package/apt_spec.rb +28 -23
  146. data/spec/unit/provider/package/aptitude_spec.rb +1 -1
  147. data/spec/unit/provider/package/base_spec.rb +6 -5
  148. data/spec/unit/provider/package/pacman_spec.rb +18 -12
  149. data/spec/unit/provider/package/pip_spec.rb +6 -11
  150. data/spec/unit/provider/package/pkgdmg_spec.rb +0 -4
  151. data/spec/unit/provider/user/aix_spec.rb +5 -0
  152. data/spec/unit/provider/user/hpux_spec.rb +1 -1
  153. data/spec/unit/provider/user/pw_spec.rb +2 -0
  154. data/spec/unit/provider/user/useradd_spec.rb +56 -3
  155. data/spec/unit/provider_spec.rb +6 -8
  156. data/spec/unit/resource/type_spec.rb +1 -1
  157. data/spec/unit/resource_spec.rb +11 -10
  158. data/spec/unit/settings_spec.rb +13 -6
  159. data/spec/unit/ssl/base_spec.rb +0 -1
  160. data/spec/unit/ssl/certificate_request_spec.rb +4 -10
  161. data/spec/unit/ssl/ssl_provider_spec.rb +5 -2
  162. data/spec/unit/transaction/additional_resource_generator_spec.rb +3 -7
  163. data/spec/unit/transaction/event_manager_spec.rb +14 -11
  164. data/spec/unit/transaction_spec.rb +13 -4
  165. data/spec/unit/type/file/content_spec.rb +0 -1
  166. data/spec/unit/type/file/selinux_spec.rb +0 -2
  167. data/spec/unit/type/file_spec.rb +0 -6
  168. data/spec/unit/type/group_spec.rb +13 -6
  169. data/spec/unit/type/resources_spec.rb +7 -7
  170. data/spec/unit/type/service_spec.rb +1 -1
  171. data/spec/unit/type/tidy_spec.rb +0 -1
  172. data/spec/unit/type_spec.rb +2 -2
  173. data/spec/unit/util/at_fork_spec.rb +2 -2
  174. data/spec/unit/util/autoload_spec.rb +5 -1
  175. data/spec/unit/util/backups_spec.rb +1 -2
  176. data/spec/unit/util/execution_spec.rb +15 -11
  177. data/spec/unit/util/inifile_spec.rb +6 -14
  178. data/spec/unit/util/log_spec.rb +8 -7
  179. data/spec/unit/util/logging_spec.rb +3 -3
  180. data/spec/unit/util/posix_spec.rb +363 -15
  181. data/spec/unit/util/selinux_spec.rb +76 -52
  182. data/spec/unit/util/storage_spec.rb +3 -1
  183. data/spec/unit/util/suidmanager_spec.rb +44 -41
  184. data/spec/unit/util/windows/sid_spec.rb +6 -0
  185. data/spec/unit/util_spec.rb +13 -6
  186. metadata +33 -16
  187. data/spec/lib/matchers/include.rb +0 -27
  188. data/spec/lib/matchers/include_spec.rb +0 -32
  189. data/spec/unit/pops/parser/parse_application_spec.rb +0 -13
  190. data/spec/unit/pops/parser/parse_capabilities_spec.rb +0 -23
  191. data/spec/unit/pops/parser/parse_site_spec.rb +0 -43
@@ -225,6 +225,9 @@ module Puppet::Environments
225
225
  private
226
226
 
227
227
  def create_environment(name)
228
+ # interpolated modulepaths may be cached from prior environment instances
229
+ Puppet.settings.clear_environment_settings(name)
230
+
228
231
  env_symbol = name.intern
229
232
  setting_values = Puppet.settings.values(env_symbol, Puppet.settings.preferred_run_mode)
230
233
  env = Puppet::Node::Environment.create(
@@ -346,17 +349,23 @@ module Puppet::Environments
346
349
  @loader = loader
347
350
  @cache_expiration_service = Puppet::Environments::Cached.cache_expiration_service
348
351
  @cache = {}
349
-
350
- # Holds expiration times in sorted order - next to expire is first
351
- @expirations = SortedSet.new
352
-
353
- # Infinity since it there are no entries, this is a cache of the first to expire time
354
- @next_expiration = END_OF_TIME
355
352
  end
356
353
 
357
354
  # @!macro loader_list
358
355
  def list
359
- @loader.list
356
+ # Evict all that have expired, in the same way as `get`
357
+ clear_all_expired
358
+
359
+ @loader.list.map do |env|
360
+ name = env.name
361
+ old_entry = @cache[name]
362
+ if old_entry
363
+ old_entry.value
364
+ else
365
+ add_entry(name, entry(env))
366
+ env
367
+ end
368
+ end
360
369
  end
361
370
 
362
371
  # @!macro loader_search_paths
@@ -379,7 +388,6 @@ module Puppet::Environments
379
388
  elsif (result = @loader.get(name))
380
389
  # environment loaded, cache it
381
390
  cache_entry = entry(result)
382
- @cache_expiration_service.created(result)
383
391
  add_entry(name, cache_entry)
384
392
  result
385
393
  end
@@ -389,28 +397,36 @@ module Puppet::Environments
389
397
  def add_entry(name, cache_entry)
390
398
  Puppet.debug {"Caching environment '#{name}' #{cache_entry.label}"}
391
399
  @cache[name] = cache_entry
392
- expires = cache_entry.expires
393
- @expirations.add(expires)
394
- if @next_expiration > expires
395
- @next_expiration = expires
396
- end
400
+ @cache_expiration_service.created(cache_entry.value)
397
401
  end
398
402
  private :add_entry
399
403
 
404
+ def clear_entry(name, entry)
405
+ @cache.delete(name)
406
+ Puppet.debug {"Evicting cache entry for environment '#{name}'"}
407
+ @cache_expiration_service.evicted(name.to_sym)
408
+ Puppet::GettextConfig.delete_text_domain(name)
409
+ Puppet.settings.clear_environment_settings(name)
410
+ end
411
+ private :clear_entry
412
+
400
413
  # Clears the cache of the environment with the given name.
401
414
  # (The intention is that this could be used from a MANUAL cache eviction command (TBD)
402
415
  def clear(name)
403
- @cache.delete(name)
404
- Puppet::GettextConfig.delete_text_domain(name)
416
+ entry = @cache[name]
417
+ clear_entry(name, entry) if entry
405
418
  end
406
419
 
407
420
  # Clears all cached environments.
408
421
  # (The intention is that this could be used from a MANUAL cache eviction command (TBD)
409
- def clear_all()
422
+ def clear_all
410
423
  super
424
+
425
+ @cache.each_pair do |name, entry|
426
+ clear_entry(name, entry)
427
+ end
428
+
411
429
  @cache = {}
412
- @expirations.clear
413
- @next_expiration = END_OF_TIME
414
430
  Puppet::GettextConfig.delete_environment_text_domains
415
431
  end
416
432
 
@@ -419,18 +435,24 @@ module Puppet::Environments
419
435
  #
420
436
  def clear_all_expired()
421
437
  t = Time.now
422
- return if t < @next_expiration && ! @cache.any? {|name, _| @cache_expiration_service.expired?(name.to_sym) }
423
- to_expire = @cache.select { |name, entry| entry.expires < t || @cache_expiration_service.expired?(name.to_sym) }
424
- to_expire.each do |name, entry|
425
- Puppet.debug {"Evicting cache entry for environment '#{name}'"}
426
- @cache_expiration_service.evicted(name.to_sym)
427
- clear(name)
428
- @expirations.delete(entry.expires)
429
- Puppet.settings.clear_environment_settings(name)
438
+
439
+ @cache.each_pair do |name, entry|
440
+ clear_if_expired(name, entry, t)
430
441
  end
431
- @next_expiration = @expirations.first || END_OF_TIME
432
442
  end
433
443
 
444
+ # Clear an environment if it is expired, either by exceeding its time to live, or
445
+ # through an explicit eviction determined by the cache expiration service.
446
+ #
447
+ def clear_if_expired(name, entry, t = Time.now)
448
+ return unless entry
449
+
450
+ if entry.expired?(t) || @cache_expiration_service.expired?(name.to_sym)
451
+ clear_entry(name, entry)
452
+ end
453
+ end
454
+ private :clear_if_expired
455
+
434
456
  # This implementation evicts the cache, and always gets the current
435
457
  # configuration of the environment
436
458
  #
@@ -440,7 +462,7 @@ module Puppet::Environments
440
462
  #
441
463
  # @!macro loader_get_conf
442
464
  def get_conf(name)
443
- evict_if_expired(name)
465
+ clear_if_expired(name, @cache[name])
444
466
  @loader.get_conf(name)
445
467
  end
446
468
 
@@ -463,17 +485,6 @@ module Puppet::Environments
463
485
  end
464
486
  end
465
487
 
466
- # Evicts the entry if it has expired
467
- # Also clears caches in Settings that may prevent the entry from being updated
468
- def evict_if_expired(name)
469
- if (result = @cache[name]) && (result.expired? || @cache_expiration_service.expired?(name.to_sym))
470
- Puppet.debug {"Evicting cache entry for environment '#{name}'"}
471
- @cache_expiration_service.evicted(name.to_sym)
472
- clear(name)
473
- Puppet.settings.clear_environment_settings(name)
474
- end
475
- end
476
-
477
488
  # Never evicting entry
478
489
  class Entry
479
490
  attr_reader :value
@@ -485,32 +496,24 @@ module Puppet::Environments
485
496
  def touch
486
497
  end
487
498
 
488
- def expired?
499
+ def expired?(now)
489
500
  false
490
501
  end
491
502
 
492
503
  def label
493
504
  ""
494
505
  end
495
-
496
- def expires
497
- END_OF_TIME
498
- end
499
506
  end
500
507
 
501
508
  # Always evicting entry
502
509
  class NotCachedEntry < Entry
503
- def expired?
510
+ def expired?(now)
504
511
  true
505
512
  end
506
513
 
507
514
  def label
508
515
  "(ttl = 0 sec)"
509
516
  end
510
-
511
- def expires
512
- START_OF_TIME
513
- end
514
517
  end
515
518
 
516
519
  # Policy that expires if it hasn't been touched within ttl_seconds
@@ -527,12 +530,8 @@ module Puppet::Environments
527
530
  @ttl = Time.now + @ttl_seconds
528
531
  end
529
532
 
530
- def expired?
531
- Time.now > @ttl
532
- end
533
-
534
- def expires
535
- @ttl
533
+ def expired?(now)
534
+ now > @ttl
536
535
  end
537
536
 
538
537
  def label
@@ -128,22 +128,46 @@ Puppet::Indirector::Face.define(:facts, '0.0.1') do
128
128
  summary _("Show legacy facts when querying all facts.")
129
129
  end
130
130
 
131
+ option("--value-only") do
132
+ summary _("Show only the value when the action is called with a single query")
133
+ end
134
+
135
+ option("--timing") do
136
+ summary _("Show how much time it took to resolve each fact.")
137
+ end
138
+
131
139
  when_invoked do |*args|
132
140
  options = args.pop
133
141
 
134
142
  Puppet.settings.preferred_run_mode = :agent
135
143
  Puppet::Node::Facts.indirection.terminus_class = :facter
136
144
 
145
+ if options[:value_only] && !args.count.eql?(1)
146
+ options[:value_only] = nil
147
+ Puppet.warning("Incorrect use of --value-only argument; it can only be used when querying for a single fact!")
148
+ end
137
149
 
138
150
  options[:user_query] = args
139
151
  options[:resolve_options] = true
140
152
  result = Puppet::Node::Facts.indirection.find(Puppet.settings[:certname], options)
141
153
 
142
- result.values
154
+ if options[:value_only]
155
+ result.values.values.first
156
+ else
157
+ result.values
158
+ end
143
159
  end
144
160
 
145
161
  when_rendering :console do |result|
146
- Puppet::Util::Json.dump(result, :pretty => true)
162
+ # VALID_TYPES = [Integer, Float, TrueClass, FalseClass, NilClass, Symbol, String, Array, Hash].freeze
163
+ # from https://github.com/puppetlabs/facter/blob/4.0.49/lib/facter/custom_facts/util/normalization.rb#L8
164
+
165
+ case result
166
+ when Array, Hash
167
+ Puppet::Util::Json.dump(result, :pretty => true)
168
+ else # one of VALID_TYPES above
169
+ result
170
+ end
147
171
  end
148
172
  end
149
173
  end
@@ -47,6 +47,14 @@ Puppet::Face.define(:node, '0.0.1') do
47
47
  end
48
48
 
49
49
  class LoggerIO
50
+ def debug(message)
51
+ Puppet.debug(message)
52
+ end
53
+
54
+ def warn(message)
55
+ Puppet.warning(message)
56
+ end
57
+
50
58
  def err(message)
51
59
  Puppet.err(message) unless message =~ /^\s*Error:\s*/
52
60
  end
@@ -0,0 +1,10 @@
1
+ require 'ffi'
2
+
3
+ module Puppet
4
+ module FFI
5
+ module POSIX
6
+ require 'puppet/ffi/posix/functions'
7
+ require 'puppet/ffi/posix/constants'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ require 'puppet/ffi/posix'
2
+
3
+ module Puppet::FFI::POSIX
4
+ module Constants
5
+ extend FFI::Library
6
+
7
+ # Maximum number of supplementary groups (groups
8
+ # that a user can be in plus its primary group)
9
+ # (64 + 1 primary group)
10
+ # Chosen a reasonable middle number from the list
11
+ # https://www.j3e.de/ngroups.html
12
+ MAXIMUM_NUMBER_OF_GROUPS = 65
13
+ end
14
+ end
@@ -0,0 +1,24 @@
1
+ require 'puppet/ffi/posix'
2
+
3
+ module Puppet::FFI::POSIX
4
+ module Functions
5
+
6
+ extend FFI::Library
7
+
8
+ ffi_convention :stdcall
9
+
10
+ # https://man7.org/linux/man-pages/man3/getgrouplist.3.html
11
+ # int getgrouplist (
12
+ # const char *user,
13
+ # gid_t group,
14
+ # gid_t *groups,
15
+ # int *ngroups
16
+ # );
17
+ begin
18
+ ffi_lib FFI::Library::LIBC
19
+ attach_function :getgrouplist, [:string, :uint, :pointer, :pointer], :int
20
+ rescue FFI::NotFoundError
21
+ # Do nothing
22
+ end
23
+ end
24
+ end
@@ -20,7 +20,7 @@ module Puppet::FFI::Windows
20
20
 
21
21
  class ::FFI::Pointer
22
22
  NULL_HANDLE = 0
23
- WCHAR_NULL = "\0\0".encode('UTF-16LE').freeze
23
+ WCHAR_NULL = "\0\0".force_encoding('UTF-16LE').freeze
24
24
 
25
25
  def self.from_string_to_wide_string(str, &block)
26
26
  str = Puppet::Util::Windows::String.wide_string(str)
@@ -375,7 +375,7 @@ module Puppet::FFI::Windows
375
375
  SERVICE_CONFIG_PRESHUTDOWN_INFO = 0x00000007
376
376
  SERVICE_CONFIG_TRIGGER_INFO = 0x00000008
377
377
  SERVICE_CONFIG_PREFERRED_NODE = 0x00000009
378
- SERVICE_CONFIG_LAUNCH_PROTECTED = 0x00000012
378
+ SERVICE_CONFIG_LAUNCH_PROTECTED = 0x0000000C
379
379
  SERVICE_NO_CHANGE = 0xffffffff
380
380
  SERVICE_CONFIG_TYPES = {
381
381
  SERVICE_CONFIG_DESCRIPTION => :SERVICE_CONFIG_DESCRIPTION,
@@ -33,8 +33,11 @@ class Puppet::FileServing::Configuration::Parser
33
33
  when "path"
34
34
  path(mount, value)
35
35
  when "allow", "deny"
36
- error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count)
37
- Puppet.err("Entry '#{line.chomp}' is unsupported and will be ignored at #{error_location_str}")
36
+ # ignore `allow *`, otherwise report error
37
+ if var != 'allow' || value != '*'
38
+ error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count)
39
+ Puppet.err("Entry '#{line.chomp}' is unsupported and will be ignored at #{error_location_str}")
40
+ end
38
41
  else
39
42
  error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count)
40
43
  raise ArgumentError.new(_("Invalid argument '%{var}' at %{error_location}") %
@@ -7,6 +7,13 @@ class Puppet::FileSystem::MemoryFile
7
7
  new(path, :exist? => false, :executable? => false)
8
8
  end
9
9
 
10
+ def self.a_missing_directory(path)
11
+ new(path,
12
+ :exist? => false,
13
+ :executable? => false,
14
+ :directory? => true)
15
+ end
16
+
10
17
  def self.a_regular_file_containing(path, content)
11
18
  new(path, :exist? => true, :executable? => false, :content => content)
12
19
  end
@@ -18,7 +25,7 @@ class Puppet::FileSystem::MemoryFile
18
25
  def self.a_directory(path, children = [])
19
26
  new(path,
20
27
  :exist? => true,
21
- :excutable? => true,
28
+ :executable? => true,
22
29
  :directory? => true,
23
30
  :children => children)
24
31
  end
@@ -128,6 +128,8 @@ class Puppet::FileSystem::Windows < Puppet::FileSystem::Posix
128
128
  end
129
129
 
130
130
  current_sid = Puppet::Util::Windows::SID.name_to_sid(Puppet::Util::Windows::ADSI::User.current_user_name)
131
+ current_sid = Puppet::Util::Windows::SID.name_to_sid(Puppet::Util::Windows::ADSI::User.current_sam_compatible_user_name) unless current_sid
132
+
131
133
  dacl = case mode
132
134
  when 0644
133
135
  dacl = secure_dacl(current_sid)
@@ -26,6 +26,10 @@ class Puppet::HTTP::Factory
26
26
 
27
27
  http = Puppet::HTTP::Proxy.proxy(URI(site.addr))
28
28
  http.use_ssl = site.use_ssl?
29
+ if site.use_ssl?
30
+ http.min_version = OpenSSL::SSL::TLS1_VERSION if http.respond_to?(:min_version)
31
+ http.ciphers = Puppet[:ciphers]
32
+ end
29
33
  http.read_timeout = Puppet[:http_read_timeout]
30
34
  http.open_timeout = Puppet[:http_connect_timeout]
31
35
  http.keep_alive_timeout = KEEP_ALIVE_TIMEOUT if http.respond_to?(:keep_alive_timeout=)
@@ -103,6 +103,7 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
103
103
  options_for_facter += " --show-legacy" if options[:show_legacy]
104
104
  options_for_facter += " --no-block" if options[:no_block] == false
105
105
  options_for_facter += " --no-cache" if options[:no_cache] == false
106
+ options_for_facter += " --timing" if options[:timing]
106
107
 
107
108
  Puppet::Node::Facts.new(request.key, Facter.resolve(options_for_facter))
108
109
  end
@@ -131,8 +131,54 @@ module Puppet::ModuleTool
131
131
  begin
132
132
  Puppet.info _("Resolving dependencies ...")
133
133
  releases = SemanticPuppet::Dependency.resolve(graph)
134
- rescue SemanticPuppet::Dependency::UnsatisfiableGraph
135
- raise NoVersionsSatisfyError, results.merge(:requested_name => name)
134
+ rescue SemanticPuppet::Dependency::UnsatisfiableGraph => e
135
+ unsatisfied = nil
136
+
137
+ if e.respond_to?(:unsatisfied)
138
+ constraints = {}
139
+ # If the module we're installing satisfies all its
140
+ # dependencies, but would break an already installed
141
+ # module that depends on it, show what would break.
142
+ if name == e.unsatisfied
143
+ graph.constraints[name].each do |mod, range, _|
144
+ next unless mod.split.include?('constraint')
145
+
146
+ # If the user requested a specific version or range,
147
+ # only show the modules with non-intersecting ranges
148
+ if options[:version]
149
+ requested_range = SemanticPuppet::VersionRange.parse(options[:version])
150
+ constraint_range = SemanticPuppet::VersionRange.parse(range)
151
+
152
+ if requested_range.intersection(constraint_range) == SemanticPuppet::VersionRange::EMPTY_RANGE
153
+ constraints[mod.split.first] = range
154
+ end
155
+ else
156
+ constraints[mod.split.first] = range
157
+ end
158
+ end
159
+
160
+ # If the module fails to satisfy one of its
161
+ # dependencies, show the unsatisfiable module
162
+ else
163
+ unsatisfied_range = graph.dependencies[name].max.constraints[e.unsatisfied].first[1]
164
+ constraints[e.unsatisfied] = unsatisfied_range
165
+ end
166
+
167
+ installed_module = @environment.module_by_forge_name(e.unsatisfied.tr('-', '/'))
168
+ current_version = installed_module.version if installed_module
169
+
170
+ unsatisfied = {
171
+ :name => e.unsatisfied,
172
+ :constraints => constraints,
173
+ :current_version => current_version
174
+ }
175
+ end
176
+
177
+ raise NoVersionsSatisfyError, results.merge(
178
+ :requested_name => name,
179
+ :requested_version => options[:version] || graph.dependencies[name].max.version.to_s,
180
+ :unsatisfied => unsatisfied
181
+ )
136
182
  end
137
183
 
138
184
  unless forced?