puppet 4.10.10 → 4.10.11
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.
- data/CONTRIBUTING.md +15 -15
- data/Gemfile +3 -0
- data/README.md +11 -11
- data/ext/project_data.yaml +4 -2
- data/lib/puppet/application/agent.rb +1 -3
- data/lib/puppet/application/apply.rb +1 -3
- data/lib/puppet/application/cert.rb +6 -1
- data/lib/puppet/application/lookup.rb +11 -1
- data/lib/puppet/configurer.rb +17 -4
- data/lib/puppet/environments.rb +1 -1
- data/lib/puppet/functions/map.rb +1 -1
- data/lib/puppet/indirector/indirection.rb +3 -3
- data/lib/puppet/indirector/request.rb +6 -2
- data/lib/puppet/network/http/connection.rb +8 -0
- data/lib/puppet/parser/functions/new.rb +29 -44
- data/lib/puppet/parser/functions/return.rb +22 -1
- data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
- data/lib/puppet/provider/group/windows_adsi.rb +4 -7
- data/lib/puppet/provider/package/dnf.rb +1 -1
- data/lib/puppet/provider/service/systemd.rb +1 -1
- data/lib/puppet/provider/user/aix.rb +1 -1
- data/lib/puppet/provider/user/windows_adsi.rb +1 -1
- data/lib/puppet/reference/configuration.rb +2 -0
- data/lib/puppet/type/tidy.rb +8 -1
- data/lib/puppet/type/user.rb +34 -3
- data/lib/puppet/util/reference.rb +2 -9
- data/lib/puppet/util/windows/adsi.rb +28 -31
- data/lib/puppet/util/windows/file.rb +61 -9
- data/lib/puppet/util/windows/principal.rb +9 -7
- data/lib/puppet/util/windows/sid.rb +60 -7
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +79 -11
- data/man/man5/puppet.conf.5 +6 -8
- data/man/man8/extlookup2hiera.8 +1 -1
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-ca.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-cert.8 +1 -1
- data/man/man8/puppet-certificate.8 +1 -1
- data/man/man8/puppet-certificate_request.8 +1 -1
- data/man/man8/puppet-certificate_revocation_list.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-file.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-inspect.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-master.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-resource_type.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/integration/application/lookup_spec.rb +21 -0
- data/spec/integration/parser/pcore_resource_spec.rb +1 -1
- data/spec/integration/util/windows/adsi_spec.rb +86 -1
- data/spec/integration/util/windows/principal_spec.rb +10 -1
- data/spec/unit/application/agent_spec.rb +0 -9
- data/spec/unit/application/apply_spec.rb +0 -9
- data/spec/unit/application/cert_spec.rb +40 -1
- data/spec/unit/configurer_spec.rb +14 -0
- data/spec/unit/indirector/indirection_spec.rb +24 -2
- data/spec/unit/provider/group/windows_adsi_spec.rb +79 -22
- data/spec/unit/provider/service/systemd_spec.rb +1 -1
- data/spec/unit/provider/user/windows_adsi_spec.rb +4 -4
- data/spec/unit/type/tidy_spec.rb +14 -0
- data/spec/unit/util/windows/adsi_spec.rb +31 -27
- data/spec/unit/util/windows/sid_spec.rb +86 -15
- data/tasks/manpages.rake +1 -1
- metadata +3621 -3609
- checksums.yaml +0 -7
data/man/man8/puppet-doc.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-DOC" "8" "
|
4
|
+
.TH "PUPPET\-DOC" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-doc\fR \- Generate Puppet references
|
data/man/man8/puppet-epp.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-EPP" "8" "
|
4
|
+
.TH "PUPPET\-EPP" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\.
|
data/man/man8/puppet-facts.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-FACTS" "8" "
|
4
|
+
.TH "PUPPET\-FACTS" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-facts\fR \- Retrieve and store facts\.
|
data/man/man8/puppet-file.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-FILE" "8" "
|
4
|
+
.TH "PUPPET\-FILE" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-file\fR \- Retrieve and store files in a filebucket
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-FILEBUCKET" "8" "
|
4
|
+
.TH "PUPPET\-FILEBUCKET" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket
|
data/man/man8/puppet-generate.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-GENERATE" "8" "
|
4
|
+
.TH "PUPPET\-GENERATE" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\.
|
data/man/man8/puppet-help.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-HELP" "8" "
|
4
|
+
.TH "PUPPET\-HELP" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-help\fR \- Display Puppet help\.
|
data/man/man8/puppet-inspect.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-INSPECT" "8" "
|
4
|
+
.TH "PUPPET\-INSPECT" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-inspect\fR \- Send an inspection report
|
data/man/man8/puppet-key.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-KEY" "8" "
|
4
|
+
.TH "PUPPET\-KEY" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-key\fR \- Create, save, and remove certificate keys\.
|
data/man/man8/puppet-lookup.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-LOOKUP" "8" "
|
4
|
+
.TH "PUPPET\-LOOKUP" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-lookup\fR \- Data in modules lookup function
|
data/man/man8/puppet-man.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-MAN" "8" "
|
4
|
+
.TH "PUPPET\-MAN" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-man\fR \- Display Puppet manual pages\.
|
data/man/man8/puppet-master.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-MASTER" "8" "
|
4
|
+
.TH "PUPPET\-MASTER" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-master\fR \- The puppet master daemon
|
data/man/man8/puppet-module.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-MODULE" "8" "
|
4
|
+
.TH "PUPPET\-MODULE" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\.
|
data/man/man8/puppet-node.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-NODE" "8" "
|
4
|
+
.TH "PUPPET\-NODE" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-node\fR \- View and manage node definitions\.
|
data/man/man8/puppet-parser.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-PARSER" "8" "
|
4
|
+
.TH "PUPPET\-PARSER" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-parser\fR \- Interact directly with the parser\.
|
data/man/man8/puppet-plugin.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-PLUGIN" "8" "
|
4
|
+
.TH "PUPPET\-PLUGIN" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\.
|
data/man/man8/puppet-report.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-REPORT" "8" "
|
4
|
+
.TH "PUPPET\-REPORT" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-report\fR \- Create, display, and submit reports\.
|
data/man/man8/puppet-resource.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-RESOURCE" "8" "
|
4
|
+
.TH "PUPPET\-RESOURCE" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-resource\fR \- The resource abstraction layer shell
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-RESOURCE_TYPE" "8" "
|
4
|
+
.TH "PUPPET\-RESOURCE_TYPE" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-resource_type\fR \- View classes, defined resource types, and nodes from all manifests\.
|
data/man/man8/puppet-status.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-STATUS" "8" "
|
4
|
+
.TH "PUPPET\-STATUS" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-status\fR \- View puppet server status\.
|
data/man/man8/puppet.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET" "8" "
|
4
|
+
.TH "PUPPET" "8" "April 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\fR
|
@@ -16,4 +16,4 @@ Available subcommands:
|
|
16
16
|
agent The puppet agent daemon apply Apply Puppet manifests locally ca Local Puppet Certificate Authority management\. (Deprecated) catalog Compile, save, view, and convert catalogs\. cert Manage certificates and requests certificate Provide access to the CA for certificate management\. certificate_request Manage certificate requests\. (Deprecated) certificate_revocation_list Manage the list of revoked certificates\. (Deprecated) config Interact with Puppet\'s settings\. describe Display help about resource types device Manage remote network devices doc Generate Puppet references epp Interact directly with the EPP template parser/renderer\. facts Retrieve and store facts\. file Retrieve and store files in a filebucket (Deprecated) filebucket Store and retrieve files in a filebucket generate Generates Puppet code from Ruby definitions\. help Display Puppet help\. inspect Send an inspection report key Create, save, and remove certificate keys\. (Deprecated) lookup Data in modules lookup function man Display Puppet manual pages\. master The puppet master daemon module Creates, installs and searches for modules on the Puppet Forge\. node View and manage node definitions\. parser Interact directly with the parser\. plugin Interact with the Puppet plugin system\. report Create, display, and submit reports\. resource The resource abstraction layer shell resource_type View classes, defined resource types, and nodes from all manifests\. status View puppet server status\. (Deprecated)
|
17
17
|
.
|
18
18
|
.P
|
19
|
-
See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v4\.10\.
|
19
|
+
See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v4\.10\.11
|
@@ -90,6 +90,27 @@ describe 'lookup' do
|
|
90
90
|
expect(lookup('a')).to eql('value a')
|
91
91
|
end
|
92
92
|
|
93
|
+
context 'uses node_terminus' do
|
94
|
+
require 'puppet/indirector/node/exec'
|
95
|
+
require 'puppet/indirector/node/plain'
|
96
|
+
|
97
|
+
let(:node) { Puppet::Node.new('testnode', :environment => env) }
|
98
|
+
|
99
|
+
it ':plain without --compile' do
|
100
|
+
Puppet.settings[:node_terminus] = 'exec'
|
101
|
+
Puppet::Node::Plain.any_instance.expects(:find).returns(node)
|
102
|
+
Puppet::Node::Exec.any_instance.expects(:find).never
|
103
|
+
expect(lookup('a')).to eql('value a')
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'configured in Puppet settings with --compile' do
|
107
|
+
Puppet.settings[:node_terminus] = 'exec'
|
108
|
+
Puppet::Node::Plain.any_instance.expects(:find).never
|
109
|
+
Puppet::Node::Exec.any_instance.expects(:find).returns(node)
|
110
|
+
expect(lookup('a', :compile => true)).to eql('value a')
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
93
114
|
context 'configured with the wrong environment' do
|
94
115
|
let(:env) { Puppet::Node::Environment.create(env_name.to_sym, [File.join(populated_env_dir, env_name, 'modules')]) }
|
95
116
|
it 'does not find data in non-existing environment' do
|
@@ -219,7 +219,7 @@ describe 'when pcore described resources types are in use' do
|
|
219
219
|
generate_and_in_a_compilers_context do |compiler|
|
220
220
|
t1 = find_resource_type(compiler.topscope, 'test1')
|
221
221
|
expect(t1.title_patterns.size).to be(1)
|
222
|
-
expect(t1.title_patterns[0][0]).to eql(/(.*)/
|
222
|
+
expect(t1.title_patterns[0][0]).to eql(/(?m-ix:(.*))/)
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
@@ -81,6 +81,91 @@ describe Puppet::Util::Windows::ADSI::Group,
|
|
81
81
|
end
|
82
82
|
|
83
83
|
describe '.members' do
|
84
|
+
it 'should return a list of members resolvable with Puppet::Util::Windows::ADSI::Group.name_sid_hash' do
|
85
|
+
temp_groupname = "g#{SecureRandom.uuid}"
|
86
|
+
temp_username = "u#{SecureRandom.uuid}"[0..12]
|
87
|
+
|
88
|
+
# select a virtual account that requires an authority to be able to resolve to SID
|
89
|
+
# the Dhcp service is chosen for no particular reason aside from it's a service available on all Windows versions
|
90
|
+
dhcp_virtualaccount = Puppet::Util::Windows::SID.name_to_principal('NT SERVICE\Dhcp')
|
91
|
+
|
92
|
+
# adding :SidTypeGroup as a group member will cause error in IAdsUser::Add
|
93
|
+
# adding :SidTypeDomain (such as S-1-5-80 / NT SERVICE or computer name) won't error
|
94
|
+
# but also won't be returned as a group member
|
95
|
+
# uncertain how to obtain :SidTypeComputer (perhaps AD? the local machine is :SidTypeDomain)
|
96
|
+
users = [
|
97
|
+
# Use sid_to_name to get localized names of SIDs - BUILTIN, SYSTEM, NT AUTHORITY, Everyone are all localized
|
98
|
+
# :SidTypeWellKnownGroup
|
99
|
+
# SYSTEM is prefixed with the NT Authority authority, resolveable with or without authority
|
100
|
+
{ :sid => 'S-1-5-18', :name => Puppet::Util::Windows::SID.sid_to_name('S-1-5-18') },
|
101
|
+
# Everyone is not prefixed with an authority, resolveable with or without NT AUTHORITY authority
|
102
|
+
{ :sid => 'S-1-1-0', :name => Puppet::Util::Windows::SID.sid_to_name('S-1-1-0') },
|
103
|
+
# Dhcp service account is prefixed with NT SERVICE authority, requires authority to resolve SID
|
104
|
+
# behavior is similar to IIS APPPOOL\DefaultAppPool
|
105
|
+
{ :sid => dhcp_virtualaccount.sid, :name => dhcp_virtualaccount.domain_account },
|
106
|
+
|
107
|
+
# :SidTypeAlias with authority component
|
108
|
+
# Administrators group is prefixed with BUILTIN authority, can be resolved with or without authority
|
109
|
+
{ :sid => 'S-1-5-32-544', :name => Puppet::Util::Windows::SID.sid_to_name('S-1-5-32-544') },
|
110
|
+
]
|
111
|
+
|
112
|
+
begin
|
113
|
+
# :SidTypeUser as user on localhost, can be resolved with or without authority prefix
|
114
|
+
user = Puppet::Util::Windows::ADSI::User.create(temp_username)
|
115
|
+
user.commit()
|
116
|
+
users.push({ :sid => user.sid.sid, :name => Puppet::Util::Windows::ADSI.computer_name + '\\' + temp_username })
|
117
|
+
|
118
|
+
# create a test group and add above 5 members by SID
|
119
|
+
group = described_class.create(temp_groupname)
|
120
|
+
group.commit()
|
121
|
+
group.set_members(users.map { |u| u[:sid]} )
|
122
|
+
|
123
|
+
# most importantly make sure that all name are convertible to SIDs
|
124
|
+
expect { described_class.name_sid_hash(group.members) }.to_not raise_error
|
125
|
+
|
126
|
+
# also verify the names returned are as expected
|
127
|
+
expected_usernames = users.map { |u| u[:name] }
|
128
|
+
expect(group.members.map(&:domain_account)).to eq(expected_usernames)
|
129
|
+
ensure
|
130
|
+
described_class.delete(temp_groupname) if described_class.exists?(temp_groupname)
|
131
|
+
Puppet::Util::Windows::ADSI::User.delete(temp_username) if Puppet::Util::Windows::ADSI::User.exists?(temp_username)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'should return a list of Principal objects even with unresolvable SIDs' do
|
136
|
+
members = [
|
137
|
+
# NULL SID is not localized
|
138
|
+
stub('WIN32OLE', {
|
139
|
+
:objectSID => [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
140
|
+
:Name => 'NULL SID',
|
141
|
+
:ole_respond_to? => true,
|
142
|
+
}),
|
143
|
+
# unresolvable SID is a different story altogether
|
144
|
+
stub('WIN32OLE', {
|
145
|
+
# completely valid SID, but Name is just a stringified version
|
146
|
+
:objectSID => [1, 5, 0, 0, 0, 0, 0, 5, 21, 0, 0, 0, 5, 113, 65, 218, 15, 127, 9, 57, 219, 4, 84, 126, 88, 4, 0, 0],
|
147
|
+
:Name => 'S-1-5-21-3661721861-956923663-2119435483-1112',
|
148
|
+
:ole_respond_to? => true,
|
149
|
+
})
|
150
|
+
]
|
151
|
+
|
152
|
+
admins_name = Puppet::Util::Windows::SID.sid_to_name('S-1-5-32-544')
|
153
|
+
admins = Puppet::Util::Windows::ADSI::Group.new(admins_name)
|
154
|
+
|
155
|
+
# touch the native_group member to have it lazily loaded, so COM objects can be stubbed
|
156
|
+
admins.native_group
|
157
|
+
admins.native_group.stubs(:Members).returns(members)
|
158
|
+
|
159
|
+
# well-known NULL SID
|
160
|
+
expect(admins.members[0].sid).to eq('S-1-0-0')
|
161
|
+
expect(admins.members[0].account_type).to eq(:SidTypeWellKnownGroup)
|
162
|
+
|
163
|
+
# unresolvable SID
|
164
|
+
expect(admins.members[1].sid).to eq('S-1-5-21-3661721861-956923663-2119435483-1112')
|
165
|
+
expect(admins.members[1].account).to eq('S-1-5-21-3661721861-956923663-2119435483-1112 (unresolvable)')
|
166
|
+
expect(admins.members[1].account_type).to eq(:SidTypeUnknown)
|
167
|
+
end
|
168
|
+
|
84
169
|
it 'should return a list of members with UTF-8 names' do
|
85
170
|
begin
|
86
171
|
original_codepage = Encoding.default_external
|
@@ -88,7 +173,7 @@ describe Puppet::Util::Windows::ADSI::Group,
|
|
88
173
|
|
89
174
|
# lookup by English name Administrators is not OK on localized Windows
|
90
175
|
admins = Puppet::Util::Windows::ADSI::Group.new(administrators_principal.account)
|
91
|
-
admins.members.each do |name|
|
176
|
+
admins.members.map(&:domain_account).each do |name|
|
92
177
|
expect(name.encoding).to be(Encoding::UTF_8)
|
93
178
|
end
|
94
179
|
ensure
|
@@ -8,7 +8,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
|
|
8
8
|
let (:system_bytes) { [1, 1, 0, 0, 0, 0, 0, 5, 18, 0, 0, 0] }
|
9
9
|
let (:null_sid_bytes) { bytes = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }
|
10
10
|
let (:administrator_bytes) { [1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2, 0, 0] }
|
11
|
-
let (:computer_sid) { Puppet::Util::Windows::SID.
|
11
|
+
let (:computer_sid) { Puppet::Util::Windows::SID.name_to_principal(Puppet::Util::Windows::ADSI.computer_name) }
|
12
12
|
# BUILTIN is localized on German Windows, but not French
|
13
13
|
# looking this up like this dilutes the values of the tests as we're comparing two mechanisms
|
14
14
|
# for returning the same values, rather than to a known good
|
@@ -23,6 +23,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
|
|
23
23
|
expect(principal.domain).to eq('')
|
24
24
|
expect(principal.domain_account).to eq('NULL SID')
|
25
25
|
expect(principal.account_type).to eq(:SidTypeWellKnownGroup)
|
26
|
+
expect(principal.to_s).to eq('NULL SID')
|
26
27
|
end
|
27
28
|
|
28
29
|
it "should create an instance from a well-known account prefixed with NT AUTHORITY" do
|
@@ -39,6 +40,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
|
|
39
40
|
expect(principal.account).to eq('SYSTEM')
|
40
41
|
expect(principal.domain).to eq('NT AUTHORITY')
|
41
42
|
expect(principal.domain_account).to eq('NT AUTHORITY\\SYSTEM')
|
43
|
+
expect(principal.to_s).to eq('NT AUTHORITY\\SYSTEM')
|
42
44
|
end
|
43
45
|
|
44
46
|
# Windows API LookupAccountSid behaves differently if current user is SYSTEM
|
@@ -87,6 +89,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
|
|
87
89
|
expect(principal.domain).to eq(domain)
|
88
90
|
expect(principal.domain_account).to eq(qualified_name)
|
89
91
|
expect(principal.account_type).to eq(:SidTypeAlias)
|
92
|
+
expect(principal.to_s).to eq(qualified_name)
|
90
93
|
end
|
91
94
|
|
92
95
|
it "should raise an error when trying to lookup an account that doesn't exist" do
|
@@ -106,6 +109,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
|
|
106
109
|
expect(principal.account).to eq(builtin_localized)
|
107
110
|
expect(principal.domain).to eq(builtin_localized)
|
108
111
|
expect(principal.domain_account).to eq(builtin_localized)
|
112
|
+
expect(principal.to_s).to eq(builtin_localized)
|
109
113
|
end
|
110
114
|
|
111
115
|
it "should return a BUILTIN domain principal for BUILTIN account names" do
|
@@ -115,6 +119,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
|
|
115
119
|
expect(principal.account).to eq(builtin_localized)
|
116
120
|
expect(principal.domain).to eq(builtin_localized)
|
117
121
|
expect(principal.domain_account).to eq(builtin_localized)
|
122
|
+
expect(principal.to_s).to eq(builtin_localized)
|
118
123
|
end
|
119
124
|
|
120
125
|
end
|
@@ -135,6 +140,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
|
|
135
140
|
expect(principal.domain).to eq(computer_sid.domain)
|
136
141
|
expect(principal.domain_account).to eq(guest_name)
|
137
142
|
expect(principal.account_type).to eq(:SidTypeUser)
|
143
|
+
expect(principal.to_s).to eq(guest_name)
|
138
144
|
end
|
139
145
|
|
140
146
|
it "should create an instance from a well-known group SID" do
|
@@ -145,6 +151,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
|
|
145
151
|
expect(principal.domain).to eq('')
|
146
152
|
expect(principal.domain_account).to eq('NULL SID')
|
147
153
|
expect(principal.account_type).to eq(:SidTypeWellKnownGroup)
|
154
|
+
expect(principal.to_s).to eq('NULL SID')
|
148
155
|
end
|
149
156
|
|
150
157
|
it "should create an instance from a well-known BUILTIN Alias SID" do
|
@@ -160,6 +167,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
|
|
160
167
|
expect(principal.domain).to eq(domain)
|
161
168
|
expect(principal.domain_account).to eq(qualified_name)
|
162
169
|
expect(principal.account_type).to eq(:SidTypeAlias)
|
170
|
+
expect(principal.to_s).to eq(qualified_name)
|
163
171
|
end
|
164
172
|
|
165
173
|
it "should raise an error when trying to lookup nil" do
|
@@ -214,6 +222,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
|
|
214
222
|
expect(principal.account).to eq(builtin_localized)
|
215
223
|
expect(principal.domain).to eq(builtin_localized)
|
216
224
|
expect(principal.domain_account).to eq(builtin_localized)
|
225
|
+
expect(principal.to_s).to eq(builtin_localized)
|
217
226
|
end
|
218
227
|
end
|
219
228
|
|
@@ -350,15 +350,6 @@ describe Puppet::Application::Agent do
|
|
350
350
|
@puppetd.setup
|
351
351
|
end
|
352
352
|
|
353
|
-
it "should set catalog cache class to nil during a noop run" do
|
354
|
-
Puppet[:catalog_cache_terminus] = "json"
|
355
|
-
Puppet[:noop] = true
|
356
|
-
Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(nil)
|
357
|
-
|
358
|
-
@puppetd.initialize_app_defaults
|
359
|
-
@puppetd.setup
|
360
|
-
end
|
361
|
-
|
362
353
|
it "should default facts_terminus setting to 'facter'" do
|
363
354
|
@puppetd.initialize_app_defaults
|
364
355
|
expect(Puppet[:facts_terminus]).to eq(:facter)
|
@@ -478,13 +478,4 @@ describe Puppet::Application::Apply do
|
|
478
478
|
@apply.initialize_app_defaults
|
479
479
|
@apply.setup
|
480
480
|
end
|
481
|
-
|
482
|
-
it "should set catalog cache class to nil during a noop run" do
|
483
|
-
Puppet[:catalog_cache_terminus] = "json"
|
484
|
-
Puppet[:noop] = true
|
485
|
-
Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(nil)
|
486
|
-
|
487
|
-
@apply.initialize_app_defaults
|
488
|
-
@apply.setup
|
489
|
-
end
|
490
481
|
end
|