bolt 0.17.1 → 0.17.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +25 -13
- data/lib/bolt/cli.rb +45 -15
- data/lib/bolt/config.rb +48 -132
- data/lib/bolt/executor.rb +3 -10
- data/lib/bolt/inventory.rb +15 -1
- data/lib/bolt/puppetdb.rb +11 -0
- data/lib/bolt/puppetdb/client.rb +68 -0
- data/lib/bolt/puppetdb/config.rb +76 -0
- data/lib/bolt/target.rb +5 -4
- data/lib/bolt/transport/base.rb +11 -2
- data/lib/bolt/transport/local.rb +11 -5
- data/lib/bolt/transport/orch.rb +16 -5
- data/lib/bolt/transport/ssh.rb +32 -1
- data/lib/bolt/transport/ssh/connection.rb +17 -10
- data/lib/bolt/transport/winrm.rb +18 -1
- data/lib/bolt/transport/winrm/connection.rb +15 -16
- data/lib/bolt/util.rb +15 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_ext/puppetdb_inventory.rb +5 -135
- data/vendored/facter/lib/facter/ec2/rest.rb +1 -1
- data/vendored/hiera/lib/hiera/version.rb +1 -1
- data/vendored/puppet/lib/puppet/application/agent.rb +1 -3
- data/vendored/puppet/lib/puppet/application/apply.rb +2 -4
- data/vendored/puppet/lib/puppet/application/cert.rb +6 -1
- data/vendored/puppet/lib/puppet/application/device.rb +100 -13
- data/vendored/puppet/lib/puppet/application/facts.rb +5 -0
- data/vendored/puppet/lib/puppet/application/lookup.rb +11 -1
- data/vendored/puppet/lib/puppet/configurer.rb +17 -4
- data/vendored/puppet/lib/puppet/configurer/plugin_handler.rb +1 -1
- data/vendored/puppet/lib/puppet/datatypes.rb +1 -1
- data/vendored/puppet/lib/puppet/defaults.rb +1 -1
- data/vendored/puppet/lib/puppet/environments.rb +2 -2
- data/vendored/puppet/lib/puppet/error.rb +6 -3
- data/vendored/puppet/lib/puppet/external/dot.rb +0 -7
- data/vendored/puppet/lib/puppet/external/nagios/parser.rb +1 -1
- data/vendored/puppet/lib/puppet/face/config.rb +41 -8
- data/vendored/puppet/lib/puppet/face/epp.rb +30 -5
- data/vendored/puppet/lib/puppet/face/facts.rb +49 -0
- data/vendored/puppet/lib/puppet/face/help.rb +33 -35
- data/vendored/puppet/lib/puppet/face/man.rb +55 -12
- data/vendored/puppet/lib/puppet/face/parser.rb +30 -3
- data/vendored/puppet/lib/puppet/file_bucket/file.rb +0 -2
- data/vendored/puppet/lib/puppet/file_serving/base.rb +10 -10
- data/vendored/puppet/lib/puppet/functions.rb +1 -3
- data/vendored/puppet/lib/puppet/functions/alert.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/all.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/annotate.rb +10 -10
- data/vendored/puppet/lib/puppet/functions/any.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/assert_type.rb +4 -4
- data/vendored/puppet/lib/puppet/functions/binary_file.rb +14 -2
- data/vendored/puppet/lib/puppet/functions/break.rb +31 -2
- data/vendored/puppet/lib/puppet/functions/call.rb +4 -4
- data/vendored/puppet/lib/puppet/functions/contain.rb +19 -3
- data/vendored/puppet/lib/puppet/functions/convert_to.rb +6 -5
- data/vendored/puppet/lib/puppet/functions/crit.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/debug.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/defined.rb +11 -9
- data/vendored/puppet/lib/puppet/functions/dig.rb +26 -2
- data/vendored/puppet/lib/puppet/functions/each.rb +8 -8
- data/vendored/puppet/lib/puppet/functions/emerg.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/empty.rb +79 -0
- data/vendored/puppet/lib/puppet/functions/err.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/filter.rb +7 -7
- data/vendored/puppet/lib/puppet/functions/find_file.rb +15 -1
- data/vendored/puppet/lib/puppet/functions/flatten.rb +64 -0
- data/vendored/puppet/lib/puppet/functions/hiera.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/hiera_array.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/hiera_hash.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/hiera_include.rb +8 -8
- data/vendored/puppet/lib/puppet/functions/include.rb +28 -2
- data/vendored/puppet/lib/puppet/functions/info.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/inline_epp.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/join.rb +56 -0
- data/vendored/puppet/lib/puppet/functions/keys.rb +25 -0
- data/vendored/puppet/lib/puppet/functions/length.rb +44 -0
- data/vendored/puppet/lib/puppet/functions/lest.rb +39 -1
- data/vendored/puppet/lib/puppet/functions/map.rb +10 -9
- data/vendored/puppet/lib/puppet/functions/match.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/new.rb +995 -2
- data/vendored/puppet/lib/puppet/functions/next.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/notice.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/reduce.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/regsubst.rb +9 -3
- data/vendored/puppet/lib/puppet/functions/require.rb +36 -2
- data/vendored/puppet/lib/puppet/functions/return.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/reverse_each.rb +71 -2
- data/vendored/puppet/lib/puppet/functions/slice.rb +23 -9
- data/vendored/puppet/lib/puppet/functions/split.rb +12 -10
- data/vendored/puppet/lib/puppet/functions/step.rb +73 -1
- data/vendored/puppet/lib/puppet/functions/strftime.rb +176 -2
- data/vendored/puppet/lib/puppet/functions/then.rb +65 -2
- data/vendored/puppet/lib/puppet/functions/tree_each.rb +19 -19
- data/vendored/puppet/lib/puppet/functions/type.rb +42 -1
- data/vendored/puppet/lib/puppet/functions/unique.rb +13 -13
- data/vendored/puppet/lib/puppet/functions/unwrap.rb +8 -4
- data/vendored/puppet/lib/puppet/functions/values.rb +25 -0
- data/vendored/puppet/lib/puppet/functions/versioncmp.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/warning.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/with.rb +6 -4
- data/vendored/puppet/lib/puppet/indirector/certificate_status/file.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/facts/facter.rb +1 -3
- data/vendored/puppet/lib/puppet/indirector/facts/rest.rb +21 -0
- data/vendored/puppet/lib/puppet/indirector/facts/yaml.rb +0 -4
- data/vendored/puppet/lib/puppet/indirector/file_content/http.rb +3 -1
- data/vendored/puppet/lib/puppet/indirector/indirection.rb +5 -3
- data/vendored/puppet/lib/puppet/indirector/request.rb +6 -2
- data/vendored/puppet/lib/puppet/module/task.rb +2 -2
- data/vendored/puppet/lib/puppet/module_tool/tar/mini.rb +57 -4
- data/vendored/puppet/lib/puppet/network/authconfig.rb +1 -1
- data/vendored/puppet/lib/puppet/network/http/api/indirected_routes.rb +1 -0
- data/vendored/puppet/lib/puppet/network/resolver.rb +1 -2
- data/vendored/puppet/lib/puppet/node.rb +4 -3
- data/vendored/puppet/lib/puppet/parser/compiler.rb +12 -5
- data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/fqdn_rand.rb +15 -4
- data/vendored/puppet/lib/puppet/parser/functions/new.rb +31 -46
- data/vendored/puppet/lib/puppet/parser/parser_factory.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/resource.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/type_loader.rb +11 -11
- data/vendored/puppet/lib/puppet/pops/evaluator/closure.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/collector_transformer.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/epp_evaluator.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +5 -2
- data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/issue_reporter.rb +18 -1
- data/vendored/puppet/lib/puppet/pops/issues.rb +6 -3
- data/vendored/puppet/lib/puppet/pops/loader/ruby_data_type_instantiator.rb +1 -2
- data/vendored/puppet/lib/puppet/pops/loader/ruby_function_instantiator.rb +1 -2
- data/vendored/puppet/lib/puppet/pops/loader/task_instantiator.rb +4 -4
- data/vendored/puppet/lib/puppet/pops/loader/type_definition_instantiator.rb +4 -1
- data/vendored/puppet/lib/puppet/pops/loaders.rb +18 -7
- data/vendored/puppet/lib/puppet/pops/lookup/global_data_provider.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/model/factory.rb +6 -3
- data/vendored/puppet/lib/puppet/pops/model/model_tree_dumper.rb +4 -0
- data/vendored/puppet/lib/puppet/pops/model/pn_transformer.rb +400 -0
- data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/parser/heredoc_support.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/parser/lexer_support.rb +3 -2
- data/vendored/puppet/lib/puppet/pops/parser/locator.rb +0 -2
- data/vendored/puppet/lib/puppet/pops/parser/pn_parser.rb +316 -0
- data/vendored/puppet/lib/puppet/pops/pcore.rb +17 -17
- data/vendored/puppet/lib/puppet/pops/pn.rb +236 -0
- data/vendored/puppet/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/types/class_loader.rb +6 -3
- data/vendored/puppet/lib/puppet/pops/types/implementation_registry.rb +28 -35
- data/vendored/puppet/lib/puppet/pops/types/p_object_type.rb +3 -3
- data/vendored/puppet/lib/puppet/pops/types/p_timespan_type.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/types/p_type_set_type.rb +24 -1
- data/vendored/puppet/lib/puppet/pops/types/ruby_generator.rb +3 -4
- data/vendored/puppet/lib/puppet/pops/types/type_calculator.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +0 -4
- data/vendored/puppet/lib/puppet/pops/types/type_mismatch_describer.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/types/type_parser.rb +14 -7
- data/vendored/puppet/lib/puppet/pops/types/types.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/utils.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +6 -2
- data/vendored/puppet/lib/puppet/provider/group/groupadd.rb +3 -1
- data/vendored/puppet/lib/puppet/provider/group/windows_adsi.rb +4 -7
- data/vendored/puppet/lib/puppet/provider/nameservice.rb +3 -3
- data/vendored/puppet/lib/puppet/provider/package/dnf.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/package/gem.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/package/pacman.rb +4 -4
- data/vendored/puppet/lib/puppet/provider/package/pip.rb +3 -3
- data/vendored/puppet/lib/puppet/provider/package/pkgdmg.rb +3 -3
- data/vendored/puppet/lib/puppet/provider/package/pkgutil.rb +2 -2
- data/vendored/puppet/lib/puppet/provider/package/portage.rb +9 -9
- data/vendored/puppet/lib/puppet/provider/package/zypper.rb +2 -2
- data/vendored/puppet/lib/puppet/provider/service/base.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/service/smf.rb +3 -2
- data/vendored/puppet/lib/puppet/provider/user/useradd.rb +6 -2
- data/vendored/puppet/lib/puppet/provider/user/windows_adsi.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/zfs/zfs.rb +3 -2
- data/vendored/puppet/lib/puppet/reference/configuration.rb +2 -0
- data/vendored/puppet/lib/puppet/reference/type.rb +11 -11
- data/vendored/puppet/lib/puppet/resource.rb +1 -1
- data/vendored/puppet/lib/puppet/resource/capability_finder.rb +2 -2
- data/vendored/puppet/lib/puppet/resource/catalog.rb +2 -2
- data/vendored/puppet/lib/puppet/resource/status.rb +9 -2
- data/vendored/puppet/lib/puppet/resource/type.rb +1 -1
- data/vendored/puppet/lib/puppet/settings.rb +31 -19
- data/vendored/puppet/lib/puppet/settings/base_setting.rb +5 -0
- data/vendored/puppet/lib/puppet/settings/config_file.rb +1 -1
- data/vendored/puppet/lib/puppet/settings/ttl_setting.rb +5 -0
- data/vendored/puppet/lib/puppet/ssl/certificate_factory.rb +2 -2
- data/vendored/puppet/lib/puppet/ssl/certificate_request.rb +0 -2
- data/vendored/puppet/lib/puppet/transaction/additional_resource_generator.rb +2 -2
- data/vendored/puppet/lib/puppet/transaction/event.rb +1 -1
- data/vendored/puppet/lib/puppet/transaction/report.rb +1 -1
- data/vendored/puppet/lib/puppet/type.rb +9 -13
- data/vendored/puppet/lib/puppet/type/augeas.rb +2 -2
- data/vendored/puppet/lib/puppet/type/cron.rb +11 -6
- data/vendored/puppet/lib/puppet/type/exec.rb +1 -1
- data/vendored/puppet/lib/puppet/type/file.rb +4 -5
- data/vendored/puppet/lib/puppet/type/host.rb +1 -1
- data/vendored/puppet/lib/puppet/type/k5login.rb +30 -54
- data/vendored/puppet/lib/puppet/type/package.rb +3 -3
- data/vendored/puppet/lib/puppet/type/schedule.rb +12 -12
- data/vendored/puppet/lib/puppet/type/scheduled_task.rb +2 -2
- data/vendored/puppet/lib/puppet/type/ssh_authorized_key.rb +5 -5
- data/vendored/puppet/lib/puppet/type/sshkey.rb +2 -2
- data/vendored/puppet/lib/puppet/type/tidy.rb +9 -2
- data/vendored/puppet/lib/puppet/type/user.rb +1 -1
- data/vendored/puppet/lib/puppet/type/yumrepo.rb +25 -4
- data/vendored/puppet/lib/puppet/type/zfs.rb +4 -0
- data/vendored/puppet/lib/puppet/util.rb +0 -4
- data/vendored/puppet/lib/puppet/util/backups.rb +1 -1
- data/vendored/puppet/lib/puppet/util/http_proxy.rb +4 -2
- data/vendored/puppet/lib/puppet/util/inifile.rb +3 -4
- data/vendored/puppet/lib/puppet/util/log.rb +2 -5
- data/vendored/puppet/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/vendored/puppet/lib/puppet/util/reference.rb +1 -8
- data/vendored/puppet/lib/puppet/util/tagging.rb +1 -1
- data/vendored/puppet/lib/puppet/util/warnings.rb +0 -2
- data/vendored/puppet/lib/puppet/util/windows/adsi.rb +15 -18
- data/vendored/puppet/lib/puppet/util/windows/com.rb +2 -1
- data/vendored/puppet/lib/puppet/util/windows/file.rb +2 -2
- data/vendored/puppet/lib/puppet/util/windows/principal.rb +7 -6
- data/vendored/puppet/lib/puppet/util/windows/sid.rb +60 -7
- data/vendored/puppet/lib/puppet/util/windows/taskscheduler.rb +0 -9
- data/vendored/puppet/lib/puppet/version.rb +1 -1
- data/vendored/puppet/lib/puppet_pal.rb +53 -48
- metadata +15 -2
@@ -76,8 +76,9 @@ module Puppet::Util::Windows::COM
|
|
76
76
|
vtable_hash = Hash[(ifaces.map { |iface| iface::VTBL::SPEC.to_a } << spec.to_a).flatten(1)]
|
77
77
|
const_set(:SPEC, vtable_hash)
|
78
78
|
|
79
|
-
layout
|
79
|
+
layout(
|
80
80
|
*self::SPEC.map { |name, signature| [name, callback(*signature)] }.flatten
|
81
|
+
)
|
81
82
|
end
|
82
83
|
|
83
84
|
const_set(:VTBL, vtable)
|
@@ -393,8 +393,6 @@ module Puppet::Util::Windows::File
|
|
393
393
|
end
|
394
394
|
module_function :lstat
|
395
395
|
|
396
|
-
private
|
397
|
-
|
398
396
|
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa364571(v=vs.85).aspx
|
399
397
|
FSCTL_GET_REPARSE_POINT = 0x900a8
|
400
398
|
|
@@ -410,6 +408,7 @@ module Puppet::Util::Windows::File
|
|
410
408
|
|
411
409
|
path
|
412
410
|
end
|
411
|
+
private_class_method :resolve_symlink
|
413
412
|
|
414
413
|
# these reparse point types are the only ones Puppet currently understands
|
415
414
|
# so rather than raising an exception in readlink, prefer to not consider
|
@@ -426,6 +425,7 @@ module Puppet::Util::Windows::File
|
|
426
425
|
|
427
426
|
symlink
|
428
427
|
end
|
428
|
+
private_class_method :symlink_reparse_point?
|
429
429
|
|
430
430
|
ffi_convention :stdcall
|
431
431
|
|
@@ -32,9 +32,10 @@ module Puppet::Util::Windows::SID
|
|
32
32
|
@sid_bytes == compare.sid_bytes
|
33
33
|
end
|
34
34
|
|
35
|
-
#
|
35
|
+
# returns authority qualified account name
|
36
|
+
# prefer to compare Principal instances with == operator or by #sid
|
36
37
|
def to_s
|
37
|
-
@
|
38
|
+
@domain_account
|
38
39
|
end
|
39
40
|
|
40
41
|
# = 8 + max sub identifiers (15) * 4
|
@@ -64,14 +65,14 @@ module Puppet::Util::Windows::SID
|
|
64
65
|
last_error = FFI.errno
|
65
66
|
|
66
67
|
if (success == FFI::WIN32_FALSE && last_error != ERROR_INSUFFICIENT_BUFFER)
|
67
|
-
raise Puppet::Util::Windows::Error.new(_('Failed to call LookupAccountNameW'), last_error)
|
68
|
+
raise Puppet::Util::Windows::Error.new(_('Failed to call LookupAccountNameW with account: %{account_name}') % { account_name: account_name}, last_error)
|
68
69
|
end
|
69
70
|
|
70
71
|
FFI::MemoryPointer.new(:lpwstr, domain_length_ptr.read_dword) do |domain_ptr|
|
71
72
|
if LookupAccountNameW(system_name_ptr, account_name_ptr,
|
72
73
|
sid_ptr, sid_length_ptr,
|
73
74
|
domain_ptr, domain_length_ptr, name_use_enum_ptr) == FFI::WIN32_FALSE
|
74
|
-
|
75
|
+
raise Puppet::Util::Windows::Error.new(_('Failed to call LookupAccountNameW with account: %{account_name}') % { account_name: account_name} )
|
75
76
|
end
|
76
77
|
|
77
78
|
# with a SID returned, loop back through lookup_account_sid to retrieve official name
|
@@ -116,14 +117,14 @@ module Puppet::Util::Windows::SID
|
|
116
117
|
last_error = FFI.errno
|
117
118
|
|
118
119
|
if (success == FFI::WIN32_FALSE && last_error != ERROR_INSUFFICIENT_BUFFER)
|
119
|
-
raise Puppet::Util::Windows::Error.new(_('Failed to call LookupAccountSidW'), last_error)
|
120
|
+
raise Puppet::Util::Windows::Error.new(_('Failed to call LookupAccountSidW with bytes: %{sid_bytes}') % { sid_bytes: sid_bytes}, last_error)
|
120
121
|
end
|
121
122
|
|
122
123
|
FFI::MemoryPointer.new(:lpwstr, name_length_ptr.read_dword) do |name_ptr|
|
123
124
|
FFI::MemoryPointer.new(:lpwstr, domain_length_ptr.read_dword) do |domain_ptr|
|
124
125
|
if LookupAccountSidW(system_name_ptr, sid_ptr, name_ptr, name_length_ptr,
|
125
126
|
domain_ptr, domain_length_ptr, name_use_enum_ptr) == FFI::WIN32_FALSE
|
126
|
-
raise Puppet::Util::Windows::Error.new(_('Failed to call LookupAccountSidW'))
|
127
|
+
raise Puppet::Util::Windows::Error.new(_('Failed to call LookupAccountSidW with bytes: %{sid_bytes}') % { sid_bytes: sid_bytes} )
|
127
128
|
end
|
128
129
|
|
129
130
|
return new(
|
@@ -52,18 +52,18 @@ module Puppet::Util::Windows
|
|
52
52
|
# 'BUILTIN\Administrators', or 'S-1-5-32-544', and will return the
|
53
53
|
# SID. Returns nil if the account doesn't exist.
|
54
54
|
def name_to_sid(name)
|
55
|
-
sid =
|
55
|
+
sid = name_to_principal(name)
|
56
56
|
|
57
57
|
sid ? sid.sid : nil
|
58
58
|
end
|
59
59
|
module_function :name_to_sid
|
60
60
|
|
61
|
-
# Convert an account name, e.g. 'Administrators' into a SID object,
|
61
|
+
# Convert an account name, e.g. 'Administrators' into a Principal::SID object,
|
62
62
|
# e.g. 'S-1-5-32-544'. The name can be specified as 'Administrators',
|
63
63
|
# 'BUILTIN\Administrators', or 'S-1-5-32-544', and will return the
|
64
64
|
# SID object. Returns nil if the account doesn't exist.
|
65
65
|
# This method returns a SID::Principal with the account, domain, SID, etc
|
66
|
-
def
|
66
|
+
def name_to_principal(name)
|
67
67
|
# Apparently, we accept a symbol..
|
68
68
|
name = name.to_s.strip if name
|
69
69
|
|
@@ -80,21 +80,50 @@ module Puppet::Util::Windows
|
|
80
80
|
rescue
|
81
81
|
nil
|
82
82
|
end
|
83
|
-
module_function :
|
83
|
+
module_function :name_to_principal
|
84
|
+
class << self; alias name_to_sid_object name_to_principal; end
|
84
85
|
|
85
|
-
# Converts an octet string array of bytes to a SID object,
|
86
|
+
# Converts an octet string array of bytes to a SID::Principal object,
|
86
87
|
# e.g. [1, 1, 0, 0, 0, 0, 0, 5, 18, 0, 0, 0] is the representation for
|
87
88
|
# S-1-5-18, the local 'SYSTEM' account.
|
88
89
|
# Raises an Error for nil or non-array input.
|
89
90
|
# This method returns a SID::Principal with the account, domain, SID, etc
|
90
|
-
def
|
91
|
+
def octet_string_to_principal(bytes)
|
91
92
|
if !bytes || !bytes.respond_to?('pack') || bytes.empty?
|
92
93
|
raise Puppet::Util::Windows::Error.new(_("Octet string must be an array of bytes"))
|
93
94
|
end
|
94
95
|
|
95
96
|
Principal.lookup_account_sid(bytes)
|
96
97
|
end
|
97
|
-
module_function :
|
98
|
+
module_function :octet_string_to_principal
|
99
|
+
class << self; alias octet_string_to_sid_object octet_string_to_principal; end
|
100
|
+
|
101
|
+
# Converts a COM instance of IAdsUser or IAdsGroup to a SID::Principal object,
|
102
|
+
# Raises an Error for nil or an object without an objectSID / Name property.
|
103
|
+
# This method returns a SID::Principal with the account, domain, SID, etc
|
104
|
+
# This method will return instances even when the SID is unresolvable, as
|
105
|
+
# may be the case when domain users have been added to local groups, but
|
106
|
+
# removed from the domain
|
107
|
+
def ads_to_principal(ads_object)
|
108
|
+
if !ads_object || !ads_object.respond_to?(:ole_respond_to?) ||
|
109
|
+
!ads_object.ole_respond_to?(:objectSID) || !ads_object.ole_respond_to?(:Name)
|
110
|
+
raise Puppet::Error.new("ads_object must be an IAdsUser or IAdsGroup instance")
|
111
|
+
end
|
112
|
+
octet_string_to_principal(ads_object.objectSID)
|
113
|
+
rescue Puppet::Util::Windows::Error => e
|
114
|
+
# if the error is not a lookup / mapping problem, immediately re-raise
|
115
|
+
raise if e.code != ERROR_NONE_MAPPED
|
116
|
+
|
117
|
+
# if the Name property isn't formatted like a SID, OR
|
118
|
+
if !valid_sid?(ads_object.Name) ||
|
119
|
+
# if the objectSID doesn't match the Name property, also raise
|
120
|
+
((converted = octet_string_to_sid_string(ads_object.objectSID)) != ads_object.Name)
|
121
|
+
raise Puppet::Error.new("ads_object Name: #{ads_object.Name} invalid or does not match objectSID: #{ads_object.objectSID} (#{converted})", e)
|
122
|
+
end
|
123
|
+
|
124
|
+
unresolved_principal(ads_object.Name, ads_object.objectSID)
|
125
|
+
end
|
126
|
+
module_function :ads_to_principal
|
98
127
|
|
99
128
|
# Convert a SID string, e.g. "S-1-5-32-544" to a name,
|
100
129
|
# e.g. 'BUILTIN\Administrators'. Returns nil if an account
|
@@ -191,6 +220,30 @@ module Puppet::Util::Windows
|
|
191
220
|
end
|
192
221
|
module_function :get_length_sid
|
193
222
|
|
223
|
+
def octet_string_to_sid_string(sid_bytes)
|
224
|
+
sid_string = nil
|
225
|
+
|
226
|
+
FFI::MemoryPointer.new(:byte, sid_bytes.length) do |sid_ptr|
|
227
|
+
sid_ptr.write_array_of_uchar(sid_bytes)
|
228
|
+
sid_string = Puppet::Util::Windows::SID.sid_ptr_to_string(sid_ptr)
|
229
|
+
end
|
230
|
+
|
231
|
+
sid_string
|
232
|
+
end
|
233
|
+
module_function :octet_string_to_sid_string
|
234
|
+
|
235
|
+
# @api private
|
236
|
+
def self.unresolved_principal(name, sid_bytes)
|
237
|
+
Principal.new(
|
238
|
+
name + " (unresolvable)", # account
|
239
|
+
sid_bytes, # sid_bytes
|
240
|
+
name, # sid string
|
241
|
+
nil, #domain
|
242
|
+
# https://msdn.microsoft.com/en-us/library/cc245534.aspx?f=255&MSPPError=-2147217396
|
243
|
+
# Indicates that the type of object could not be determined. For example, no object with that SID exists.
|
244
|
+
:SidTypeUnknown)
|
245
|
+
end
|
246
|
+
|
194
247
|
ffi_convention :stdcall
|
195
248
|
|
196
249
|
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379151(v=vs.85).aspx
|
@@ -12,8 +12,6 @@ module Win32
|
|
12
12
|
# The error class raised if any task scheduler specific calls fail.
|
13
13
|
class Error < Puppet::Util::Windows::Error; end
|
14
14
|
|
15
|
-
private
|
16
|
-
|
17
15
|
class << self
|
18
16
|
attr_accessor :com_initialized
|
19
17
|
end
|
@@ -92,8 +90,6 @@ module Win32
|
|
92
90
|
# No mapping between account names and security IDs was done.
|
93
91
|
ERROR_NONE_MAPPED = -2147023564 # 0x80070534 WIN32 Error CODE 1332 (0x534)
|
94
92
|
|
95
|
-
public
|
96
|
-
|
97
93
|
# :startdoc:
|
98
94
|
|
99
95
|
# Shorthand constants
|
@@ -935,8 +931,6 @@ module Win32
|
|
935
931
|
new_hash
|
936
932
|
end
|
937
933
|
|
938
|
-
private
|
939
|
-
|
940
934
|
def reset_current_task
|
941
935
|
# Ensure that COM reference is decremented properly
|
942
936
|
@pITask.Release if @pITask && ! @pITask.null?
|
@@ -1052,12 +1046,9 @@ module Win32
|
|
1052
1046
|
|
1053
1047
|
module COM
|
1054
1048
|
extend FFI::Library
|
1055
|
-
private
|
1056
1049
|
|
1057
1050
|
com = Puppet::Util::Windows::COM
|
1058
1051
|
|
1059
|
-
public
|
1060
|
-
|
1061
1052
|
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa381811(v=vs.85).aspx
|
1062
1053
|
ITaskScheduler = com::Interface[com::IUnknown,
|
1063
1054
|
FFI::WIN32::GUID['148BD527-A2AB-11CE-B11F-00AA00530503'],
|
@@ -680,8 +680,6 @@ module Pal
|
|
680
680
|
in_environment_context(environments, env, facts, variables, &block)
|
681
681
|
end
|
682
682
|
|
683
|
-
private
|
684
|
-
|
685
683
|
# Prepares the puppet context with pal information - and delegates to the block
|
686
684
|
# No set up is performed at this step - it is delayed until it is known what the
|
687
685
|
# operation is going to be (for example - using a ScriptCompiler).
|
@@ -701,6 +699,7 @@ module Pal
|
|
701
699
|
return block.call(self)
|
702
700
|
end
|
703
701
|
end
|
702
|
+
private_class_method :in_environment_context
|
704
703
|
|
705
704
|
# Prepares the node for use by giving it node_facts (if given)
|
706
705
|
# If a hash of facts values is given, then the operation of creating a node with facts is much
|
@@ -717,6 +716,7 @@ module Pal
|
|
717
716
|
node.add_server_facts({})
|
718
717
|
end
|
719
718
|
end
|
719
|
+
private_class_method :prepare_node_facts
|
720
720
|
|
721
721
|
def self.add_variables(scope, variables)
|
722
722
|
return if variables.nil?
|
@@ -737,6 +737,7 @@ module Pal
|
|
737
737
|
scope.setvar(k, v)
|
738
738
|
end
|
739
739
|
end
|
740
|
+
private_class_method :add_variables
|
740
741
|
|
741
742
|
# The main routine for script compiler
|
742
743
|
# Picks up information from the puppet context and configures a script compiler which is given to
|
@@ -784,59 +785,60 @@ module Pal
|
|
784
785
|
|
785
786
|
# TRANSLATORS, the string "For puppet PAL" is not user facing
|
786
787
|
Puppet.override({:current_environment => apply_environment}, "For puppet PAL") do
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
end
|
788
|
+
begin
|
789
|
+
# support the following features when evaluating puppet code
|
790
|
+
# * $facts with facts from host running the script
|
791
|
+
# * $settings with 'settings::*' namespace populated, and '$settings::all_local' hash
|
792
|
+
# * $trusted as setup when using puppet apply
|
793
|
+
# * an environment
|
794
|
+
#
|
795
|
+
|
796
|
+
# fixup trusted information
|
797
|
+
node.sanitize()
|
798
|
+
|
799
|
+
compiler = Puppet::Parser::ScriptCompiler.new(node.environment, node.name)
|
800
|
+
topscope = compiler.topscope
|
801
|
+
|
802
|
+
# When scripting the trusted data are always local, but set them anyway
|
803
|
+
topscope.set_trusted(node.trusted_data)
|
804
|
+
|
805
|
+
# Server facts are always about the local node's version etc.
|
806
|
+
topscope.set_server_facts(node.server_facts)
|
807
|
+
|
808
|
+
# Set $facts for the node running the script
|
809
|
+
facts_hash = node.facts.nil? ? {} : node.facts.values
|
810
|
+
topscope.set_facts(facts_hash)
|
811
|
+
|
812
|
+
# create the $settings:: variables
|
813
|
+
topscope.merge_settings(node.environment.name, false)
|
814
|
+
|
815
|
+
add_variables(topscope, pal_variables)
|
816
|
+
|
817
|
+
# compiler.compile(&block)
|
818
|
+
compiler.compile do | internal_compiler |
|
819
|
+
# wrap the internal compiler to prevent it from leaking in the PAL API
|
820
|
+
if block_given?
|
821
|
+
script_compiler = ScriptCompiler.new(internal_compiler)
|
822
|
+
|
823
|
+
# Make compiler available to Puppet#lookup
|
824
|
+
overrides[:pal_script_compiler] = script_compiler
|
825
|
+
Puppet.override(overrides, "PAL::with_script_compiler") do # TRANSLATORS: Do not translate, symbolic name
|
826
|
+
yield(script_compiler)
|
827
827
|
end
|
828
828
|
end
|
829
|
+
end
|
829
830
|
|
830
|
-
|
831
|
-
|
832
|
-
|
831
|
+
rescue Puppet::ParseErrorWithIssue, Puppet::Error
|
832
|
+
# already logged and handled by the compiler for these two cases
|
833
|
+
raise
|
833
834
|
|
834
|
-
|
835
|
-
|
836
|
-
|
835
|
+
rescue => detail
|
836
|
+
Puppet.log_exception(detail)
|
837
|
+
raise
|
837
838
|
end
|
838
839
|
end
|
839
840
|
end
|
841
|
+
private_class_method :main
|
840
842
|
|
841
843
|
T_STRING = Puppet::Pops::Types::PStringType::NON_EMPTY
|
842
844
|
T_STRING_ARRAY = Puppet::Pops::Types::TypeFactory.array_of(T_STRING)
|
@@ -857,18 +859,21 @@ module Pal
|
|
857
859
|
def self.assert_optionally_empty_array(a, what, allow_nil=false)
|
858
860
|
assert_type(T_STRING_ARRAY, a, what, allow_nil)
|
859
861
|
end
|
862
|
+
private_class_method :assert_optionally_empty_array
|
860
863
|
|
861
864
|
def self.assert_mutually_exclusive(a, b, a_term, b_term)
|
862
865
|
if a && b
|
863
866
|
raise ArgumentError, _("Cannot use '%{a_term}' and '%{b_term}' at the same time") % { a_term: a_term, b_term: b_term }
|
864
867
|
end
|
865
868
|
end
|
869
|
+
private_class_method :assert_mutually_exclusive
|
866
870
|
|
867
871
|
def self.assert_block_given(block)
|
868
872
|
if block.nil?
|
869
873
|
raise ArgumentError, _("A block must be given")
|
870
874
|
end
|
871
875
|
end
|
876
|
+
private_class_method :assert_block_given
|
872
877
|
end
|
873
878
|
end
|
874
879
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bolt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -349,6 +349,9 @@ files:
|
|
349
349
|
- lib/bolt/outputter/human.rb
|
350
350
|
- lib/bolt/outputter/json.rb
|
351
351
|
- lib/bolt/pal.rb
|
352
|
+
- lib/bolt/puppetdb.rb
|
353
|
+
- lib/bolt/puppetdb/client.rb
|
354
|
+
- lib/bolt/puppetdb/config.rb
|
352
355
|
- lib/bolt/result.rb
|
353
356
|
- lib/bolt/result_set.rb
|
354
357
|
- lib/bolt/target.rb
|
@@ -697,11 +700,13 @@ files:
|
|
697
700
|
- vendored/puppet/lib/puppet/functions/dig.rb
|
698
701
|
- vendored/puppet/lib/puppet/functions/each.rb
|
699
702
|
- vendored/puppet/lib/puppet/functions/emerg.rb
|
703
|
+
- vendored/puppet/lib/puppet/functions/empty.rb
|
700
704
|
- vendored/puppet/lib/puppet/functions/epp.rb
|
701
705
|
- vendored/puppet/lib/puppet/functions/err.rb
|
702
706
|
- vendored/puppet/lib/puppet/functions/eyaml_lookup_key.rb
|
703
707
|
- vendored/puppet/lib/puppet/functions/filter.rb
|
704
708
|
- vendored/puppet/lib/puppet/functions/find_file.rb
|
709
|
+
- vendored/puppet/lib/puppet/functions/flatten.rb
|
705
710
|
- vendored/puppet/lib/puppet/functions/hiera.rb
|
706
711
|
- vendored/puppet/lib/puppet/functions/hiera_array.rb
|
707
712
|
- vendored/puppet/lib/puppet/functions/hiera_hash.rb
|
@@ -711,7 +716,10 @@ files:
|
|
711
716
|
- vendored/puppet/lib/puppet/functions/include.rb
|
712
717
|
- vendored/puppet/lib/puppet/functions/info.rb
|
713
718
|
- vendored/puppet/lib/puppet/functions/inline_epp.rb
|
719
|
+
- vendored/puppet/lib/puppet/functions/join.rb
|
714
720
|
- vendored/puppet/lib/puppet/functions/json_data.rb
|
721
|
+
- vendored/puppet/lib/puppet/functions/keys.rb
|
722
|
+
- vendored/puppet/lib/puppet/functions/length.rb
|
715
723
|
- vendored/puppet/lib/puppet/functions/lest.rb
|
716
724
|
- vendored/puppet/lib/puppet/functions/lookup.rb
|
717
725
|
- vendored/puppet/lib/puppet/functions/map.rb
|
@@ -735,6 +743,7 @@ files:
|
|
735
743
|
- vendored/puppet/lib/puppet/functions/type.rb
|
736
744
|
- vendored/puppet/lib/puppet/functions/unique.rb
|
737
745
|
- vendored/puppet/lib/puppet/functions/unwrap.rb
|
746
|
+
- vendored/puppet/lib/puppet/functions/values.rb
|
738
747
|
- vendored/puppet/lib/puppet/functions/versioncmp.rb
|
739
748
|
- vendored/puppet/lib/puppet/functions/warning.rb
|
740
749
|
- vendored/puppet/lib/puppet/functions/with.rb
|
@@ -788,6 +797,7 @@ files:
|
|
788
797
|
- vendored/puppet/lib/puppet/indirector/facts/facter.rb
|
789
798
|
- vendored/puppet/lib/puppet/indirector/facts/memory.rb
|
790
799
|
- vendored/puppet/lib/puppet/indirector/facts/network_device.rb
|
800
|
+
- vendored/puppet/lib/puppet/indirector/facts/rest.rb
|
791
801
|
- vendored/puppet/lib/puppet/indirector/facts/store_configs.rb
|
792
802
|
- vendored/puppet/lib/puppet/indirector/facts/yaml.rb
|
793
803
|
- vendored/puppet/lib/puppet/indirector/file_bucket_file/file.rb
|
@@ -1102,6 +1112,7 @@ files:
|
|
1102
1112
|
- vendored/puppet/lib/puppet/pops/model/factory.rb
|
1103
1113
|
- vendored/puppet/lib/puppet/pops/model/model_label_provider.rb
|
1104
1114
|
- vendored/puppet/lib/puppet/pops/model/model_tree_dumper.rb
|
1115
|
+
- vendored/puppet/lib/puppet/pops/model/pn_transformer.rb
|
1105
1116
|
- vendored/puppet/lib/puppet/pops/model/tree_dumper.rb
|
1106
1117
|
- vendored/puppet/lib/puppet/pops/parser/code_merger.rb
|
1107
1118
|
- vendored/puppet/lib/puppet/pops/parser/eparser.rb
|
@@ -1115,9 +1126,11 @@ files:
|
|
1115
1126
|
- vendored/puppet/lib/puppet/pops/parser/locatable.rb
|
1116
1127
|
- vendored/puppet/lib/puppet/pops/parser/locator.rb
|
1117
1128
|
- vendored/puppet/lib/puppet/pops/parser/parser_support.rb
|
1129
|
+
- vendored/puppet/lib/puppet/pops/parser/pn_parser.rb
|
1118
1130
|
- vendored/puppet/lib/puppet/pops/parser/slurp_support.rb
|
1119
1131
|
- vendored/puppet/lib/puppet/pops/patterns.rb
|
1120
1132
|
- vendored/puppet/lib/puppet/pops/pcore.rb
|
1133
|
+
- vendored/puppet/lib/puppet/pops/pn.rb
|
1121
1134
|
- vendored/puppet/lib/puppet/pops/puppet_stack.rb
|
1122
1135
|
- vendored/puppet/lib/puppet/pops/resource/param.rb
|
1123
1136
|
- vendored/puppet/lib/puppet/pops/resource/resource_type_impl.rb
|