puppet 2.7.13 → 2.7.14
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/CHANGELOG +144 -1
- data/conf/osx/preflight +1 -1
- data/conf/redhat/puppet.spec +9 -5
- data/conf/suse/puppet.spec +4 -1
- data/conf/windows/eventlog/Rakefile +32 -0
- data/conf/windows/eventlog/puppetres.dll +0 -0
- data/conf/windows/eventlog/puppetres.mc +18 -0
- data/ext/rack/files/apache2.conf +3 -0
- data/install.rb +23 -1
- data/lib/puppet.rb +1 -1
- data/lib/puppet/agent.rb +1 -14
- data/lib/puppet/application/kick.rb +1 -1
- data/lib/puppet/application/module.rb +11 -0
- data/lib/puppet/daemon.rb +74 -3
- data/lib/puppet/defaults.rb +1 -1
- data/lib/puppet/face/certificate.rb +1 -1
- data/lib/puppet/face/help/man.erb +1 -1
- data/lib/puppet/face/module.rb +17 -0
- data/lib/puppet/face/module/build.rb +10 -4
- data/lib/puppet/face/module/changes.rb +5 -5
- data/lib/puppet/face/module/generate.rb +6 -4
- data/lib/puppet/face/module/install.rb +122 -32
- data/lib/puppet/face/module/list.rb +234 -33
- data/lib/puppet/face/module/search.rb +56 -23
- data/lib/puppet/face/module/uninstall.rb +33 -38
- data/lib/puppet/face/module/upgrade.rb +84 -0
- data/lib/puppet/feature/eventlog.rb +6 -0
- data/lib/puppet/forge.rb +67 -122
- data/lib/puppet/forge/cache.rb +1 -1
- data/lib/puppet/forge/repository.rb +6 -25
- data/lib/puppet/indirector/facts/network_device.rb +1 -1
- data/lib/puppet/interface/action.rb +1 -1
- data/lib/puppet/module.rb +79 -28
- data/lib/puppet/module_tool.rb +72 -34
- data/lib/puppet/module_tool/applications.rb +12 -14
- data/lib/puppet/module_tool/applications/application.rb +21 -19
- data/lib/puppet/module_tool/applications/builder.rb +4 -4
- data/lib/puppet/module_tool/applications/checksummer.rb +12 -3
- data/lib/puppet/module_tool/applications/generator.rb +1 -1
- data/lib/puppet/module_tool/applications/installer.rb +163 -34
- data/lib/puppet/module_tool/applications/searcher.rb +2 -3
- data/lib/puppet/module_tool/applications/uninstaller.rb +84 -36
- data/lib/puppet/module_tool/applications/unpacker.rb +4 -26
- data/lib/puppet/module_tool/applications/upgrader.rb +109 -0
- data/lib/puppet/module_tool/checksums.rb +2 -2
- data/lib/puppet/module_tool/contents_description.rb +1 -1
- data/lib/puppet/module_tool/dependency.rb +2 -2
- data/lib/puppet/module_tool/errors.rb +9 -0
- data/lib/puppet/module_tool/errors/base.rb +15 -0
- data/lib/puppet/module_tool/errors/installer.rb +90 -0
- data/lib/puppet/module_tool/errors/shared.rb +115 -0
- data/lib/puppet/module_tool/errors/uninstaller.rb +45 -0
- data/lib/puppet/module_tool/errors/upgrader.rb +72 -0
- data/lib/puppet/module_tool/metadata.rb +2 -2
- data/lib/puppet/module_tool/modulefile.rb +7 -7
- data/lib/puppet/module_tool/shared_behaviors.rb +161 -0
- data/lib/puppet/module_tool/skeleton.rb +1 -1
- data/lib/puppet/node/environment.rb +4 -2
- data/lib/puppet/parser/ast/leaf.rb +1 -1
- data/lib/puppet/parser/functions/create_resources.rb +3 -2
- data/lib/puppet/parser/scope.rb +44 -9
- data/lib/puppet/provider/augeas/augeas.rb +2 -2
- data/lib/puppet/provider/exec.rb +8 -3
- data/lib/puppet/provider/exec/shell.rb +1 -2
- data/lib/puppet/provider/nameservice/directoryservice.rb +10 -4
- data/lib/puppet/provider/package/gem.rb +1 -1
- data/lib/puppet/provider/package/pkg.rb +10 -21
- data/lib/puppet/provider/selmodule/semodule.rb +1 -2
- data/lib/puppet/provider/service/upstart.rb +33 -17
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
- data/lib/puppet/rails/inventory_node.rb +7 -7
- data/lib/puppet/reports/http.rb +4 -1
- data/lib/puppet/reports/tagmail.rb +8 -1
- data/lib/puppet/resource/type.rb +1 -1
- data/lib/puppet/test/test_helper.rb +138 -0
- data/lib/puppet/type.rb +9 -1
- data/lib/puppet/type/file.rb +18 -10
- data/lib/puppet/type/package.rb +13 -9
- data/lib/puppet/type/resources.rb +1 -1
- data/lib/puppet/type/ssh_authorized_key.rb +3 -4
- data/lib/puppet/type/sshkey.rb +4 -4
- data/lib/puppet/type/user.rb +1 -0
- data/lib/puppet/type/vlan.rb +1 -1
- data/lib/puppet/util.rb +31 -14
- data/lib/puppet/util/autoload.rb +1 -1
- data/lib/puppet/util/command_line.rb +2 -6
- data/lib/puppet/util/instrumentation/indirection_probe.rb +1 -1
- data/lib/puppet/util/instrumentation/instrumentable.rb +1 -1
- data/lib/puppet/util/instrumentation/listeners/log.rb +1 -1
- data/lib/puppet/util/instrumentation/listeners/performance.rb +1 -1
- data/lib/puppet/util/log.rb +3 -1
- data/lib/puppet/util/log/destinations.rb +38 -0
- data/lib/puppet/util/monkey_patches.rb +45 -0
- data/lib/puppet/util/network_device/base.rb +1 -1
- data/lib/puppet/util/network_device/cisco.rb +1 -1
- data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/lib/puppet/util/network_device/cisco/interface.rb +1 -1
- data/lib/puppet/util/network_device/config.rb +1 -1
- data/lib/puppet/util/network_device/ipcalc.rb +1 -1
- data/lib/puppet/util/network_device/transport.rb +1 -1
- data/lib/puppet/util/network_device/transport/base.rb +1 -1
- data/lib/puppet/util/network_device/transport/ssh.rb +1 -1
- data/lib/puppet/util/settings.rb +2 -11
- data/lib/puppet/util/settings/file_setting.rb +3 -5
- data/lib/puppet/util/terminal.rb +16 -0
- data/lib/puppet/util/zaml.rb +3 -1
- data/lib/semver.rb +15 -7
- data/spec/fixtures/releases/jamtur01-apache/metadata.json +1 -1
- data/spec/fixtures/unit/parser/lexer/arithmetic_expression.pp +1 -1
- data/spec/fixtures/unit/provider/package/pkg/dummy +1 -0
- data/spec/fixtures/unit/provider/package/pkg/incomplete +1 -0
- data/spec/fixtures/unit/provider/package/pkg/publisher +2 -0
- data/spec/fixtures/unit/provider/package/pkg/simple +4 -0
- data/spec/fixtures/unit/reports/tagmail/tagmail_email.conf +2 -0
- data/spec/fixtures/yaml/report0.25.x.yaml +1 -1
- data/spec/fixtures/yaml/report2.6.x.yaml +1 -1
- data/spec/integration/faces/documentation_spec.rb +1 -1
- data/spec/integration/network/rest_authconfig_spec.rb +1 -1
- data/spec/lib/puppet_spec/compiler.rb +6 -0
- data/spec/lib/puppet_spec/database.rb +30 -0
- data/spec/lib/puppet_spec/files.rb +4 -2
- data/spec/shared_behaviours/path_parameters.rb +2 -29
- data/spec/shared_contexts/platform.rb +43 -0
- data/spec/spec_helper.rb +36 -65
- data/spec/unit/agent_spec.rb +0 -32
- data/spec/unit/application/kick_spec.rb +2 -2
- data/spec/unit/daemon_spec.rb +1 -17
- data/spec/unit/face/module/install_spec.rb +158 -0
- data/spec/unit/face/module/list_spec.rb +182 -0
- data/spec/unit/face/module/search_spec.rb +163 -0
- data/spec/unit/face/module/uninstall_spec.rb +77 -0
- data/spec/unit/face/module/upgrade_spec.rb +26 -0
- data/spec/unit/forge/repository_spec.rb +0 -30
- data/spec/unit/forge_spec.rb +28 -86
- data/spec/unit/indirector/catalog/active_record_spec.rb +45 -65
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +5 -18
- data/spec/unit/indirector/resource/active_record_spec.rb +2 -11
- data/spec/unit/indirector/resource/ral_spec.rb +7 -2
- data/spec/unit/module_spec.rb +240 -107
- data/spec/unit/module_tool/application_spec.rb +3 -5
- data/spec/unit/module_tool/applications/application_spec.rb +19 -0
- data/spec/unit/module_tool/applications/installer_spec.rb +205 -0
- data/spec/unit/module_tool/applications/uninstaller_spec.rb +206 -0
- data/spec/unit/module_tool/applications/upgrader_spec.rb +37 -0
- data/spec/unit/module_tool/metadata_spec.rb +2 -2
- data/spec/unit/module_tool_spec.rb +109 -1
- data/spec/unit/node/environment_spec.rb +16 -1
- data/spec/unit/parser/ast/leaf_spec.rb +16 -1
- data/spec/unit/parser/collector_spec.rb +2 -12
- data/spec/unit/parser/functions/create_resources_spec.rb +135 -86
- data/spec/unit/parser/functions/generate_spec.rb +2 -10
- data/spec/unit/parser/scope_spec.rb +345 -16
- data/spec/unit/provider/augeas/augeas_spec.rb +19 -0
- data/spec/unit/provider/exec/shell_spec.rb +17 -14
- data/spec/unit/provider/exec/windows_spec.rb +1 -7
- data/spec/unit/provider/exec_spec.rb +35 -0
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +10 -0
- data/spec/unit/provider/package/dpkg_spec.rb +2 -1
- data/spec/unit/provider/package/gem_spec.rb +15 -0
- data/spec/unit/provider/package/openbsd_spec.rb +5 -4
- data/spec/unit/provider/package/pacman_spec.rb +3 -2
- data/spec/unit/provider/package/pkg_spec.rb +56 -33
- data/spec/unit/provider/selmodule_spec.rb +11 -4
- data/spec/unit/provider/service/redhat_spec.rb +1 -3
- data/spec/unit/provider/service/smf_spec.rb +1 -3
- data/spec/unit/provider/service/upstart_spec.rb +38 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +28 -0
- data/spec/unit/rails/host_spec.rb +6 -12
- data/spec/unit/rails/param_value_spec.rb +3 -8
- data/spec/unit/rails/resource_spec.rb +2 -8
- data/spec/unit/reports/http_spec.rb +47 -31
- data/spec/unit/reports/tagmail_spec.rb +77 -0
- data/spec/unit/resource/type_spec.rb +2 -2
- data/spec/unit/resource_spec.rb +18 -20
- data/spec/unit/semver_spec.rb +31 -13
- data/spec/unit/type/exec_spec.rb +8 -15
- data/spec/unit/type/group_spec.rb +0 -9
- data/spec/unit/type/package_spec.rb +10 -0
- data/spec/unit/type/resources_spec.rb +4 -5
- data/spec/unit/type/ssh_authorized_key_spec.rb +4 -15
- data/spec/unit/type/sshkey_spec.rb +9 -11
- data/spec/unit/type/user_spec.rb +123 -127
- data/spec/unit/type_spec.rb +20 -0
- data/spec/unit/util/command_line_spec.rb +2 -2
- data/spec/unit/util/instrumentation/data_spec.rb +1 -1
- data/spec/unit/util/instrumentation/indirection_probe_spec.rb +1 -1
- data/spec/unit/util/instrumentation/instrumentable_spec.rb +1 -1
- data/spec/unit/util/instrumentation/listener_spec.rb +1 -1
- data/spec/unit/util/instrumentation/listeners/log_spec.rb +1 -1
- data/spec/unit/util/instrumentation/listeners/performance_spec.rb +1 -1
- data/spec/unit/util/instrumentation_spec.rb +1 -1
- data/spec/unit/util/log/destinations_spec.rb +4 -8
- data/spec/unit/util/log_spec.rb +47 -0
- data/spec/unit/util/reference_spec.rb +1 -1
- data/spec/unit/util/settings/file_setting_spec.rb +9 -0
- data/spec/unit/util/settings_spec.rb +0 -53
- data/spec/unit/util/terminal_spec.rb +42 -0
- data/spec/unit/util/zaml_spec.rb +7 -0
- data/spec/unit/util_spec.rb +63 -20
- data/tasks/rake/manpages.rake +1 -1
- data/test/data/snippets/arithmetic_expression.pp +1 -1
- data/test/other/puppet.rb +0 -1
- data/test/util/log.rb +6 -6
- metadata +41 -16
- data/lib/puppet/external/event-loop.rb +0 -1
- data/lib/puppet/external/event-loop/better-definers.rb +0 -367
- data/lib/puppet/external/event-loop/event-loop.rb +0 -355
- data/lib/puppet/external/event-loop/signal-system.rb +0 -218
- data/lib/puppet/face/module/clean.rb +0 -30
- data/lib/puppet/module_tool/applications/cleaner.rb +0 -16
- data/lib/puppet/module_tool/skeleton/templates/generator/metadata.json +0 -12
- data/lib/puppet/module_tool/utils.rb +0 -5
- data/lib/puppet/module_tool/utils/interrogation.rb +0 -25
- data/spec/integration/module_tool_spec.rb +0 -475
- data/spec/unit/module_tool/uninstaller_spec.rb +0 -124
@@ -1,24 +1,18 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
2
|
require 'spec_helper'
|
3
|
-
begin
|
4
|
-
require 'sqlite3'
|
5
|
-
rescue LoadError
|
6
|
-
end
|
7
|
-
require 'tempfile'
|
8
3
|
require 'puppet/rails'
|
9
4
|
|
10
|
-
describe "Puppet::Node::Facts::InventoryActiveRecord", :if =>
|
5
|
+
describe "Puppet::Node::Facts::InventoryActiveRecord", :if => can_use_scratch_database? do
|
6
|
+
include PuppetSpec::Files
|
7
|
+
|
11
8
|
let(:terminus) { Puppet::Node::Facts::InventoryActiveRecord.new }
|
12
9
|
|
13
10
|
before :all do
|
14
11
|
require 'puppet/indirector/facts/inventory_active_record'
|
15
|
-
@dbfile = Tempfile.new("testdb")
|
16
|
-
@dbfile.close
|
17
12
|
end
|
18
13
|
|
19
|
-
after :
|
14
|
+
after :each do
|
20
15
|
Puppet::Node::Facts.indirection.reset_terminus_class
|
21
|
-
@dbfile.unlink
|
22
16
|
end
|
23
17
|
|
24
18
|
before :each do
|
@@ -26,14 +20,7 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r
|
|
26
20
|
Puppet::Node.indirection.cache_class = nil
|
27
21
|
|
28
22
|
Puppet::Node::Facts.indirection.terminus_class = :inventory_active_record
|
29
|
-
|
30
|
-
Puppet[:dblocation] = @dbfile.path
|
31
|
-
Puppet[:railslog] = "/dev/null"
|
32
|
-
Puppet::Rails.init
|
33
|
-
end
|
34
|
-
|
35
|
-
after :each do
|
36
|
-
Puppet::Rails.teardown
|
23
|
+
setup_scratch_database
|
37
24
|
end
|
38
25
|
|
39
26
|
describe "#save" do
|
@@ -1,22 +1,13 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
2
|
require 'spec_helper'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'sqlite3'
|
6
|
-
rescue LoadError
|
7
|
-
end
|
8
|
-
|
9
3
|
require 'puppet/rails'
|
10
4
|
require 'puppet/node/facts'
|
11
5
|
|
12
|
-
describe "Puppet::Resource::ActiveRecord", :if =>
|
6
|
+
describe "Puppet::Resource::ActiveRecord", :if => can_use_scratch_database? do
|
13
7
|
include PuppetSpec::Files
|
14
8
|
|
15
9
|
before :each do
|
16
|
-
|
17
|
-
Puppet[:vardir] = dir.to_s
|
18
|
-
Puppet[:dbadapter] = 'sqlite3'
|
19
|
-
Puppet[:dblocation] = (dir + 'storeconfigs.sqlite').to_s
|
10
|
+
setup_scratch_database
|
20
11
|
Puppet[:storeconfigs] = true
|
21
12
|
end
|
22
13
|
|
@@ -20,12 +20,17 @@ describe "Puppet::Resource::Ral" do
|
|
20
20
|
|
21
21
|
it "if there is no instance, it should create one", :'fails_on_ruby_1.9.2' => true do
|
22
22
|
wrong_instance = stub "wrong user", :name => "bob"
|
23
|
+
root = mock "Root User"
|
24
|
+
root_resource = mock "Root Resource"
|
23
25
|
|
24
26
|
require 'puppet/type/user'
|
25
27
|
Puppet::Type::User.expects(:instances).returns([ wrong_instance, wrong_instance ])
|
28
|
+
Puppet::Type::User.expects(:new).with(has_entry(:name => "root")).returns(root)
|
29
|
+
root.expects(:to_resource).returns(root_resource)
|
30
|
+
|
26
31
|
result = Puppet::Resource::Ral.new.find(@request)
|
27
|
-
|
28
|
-
result.
|
32
|
+
|
33
|
+
result.should == root_resource
|
29
34
|
end
|
30
35
|
end
|
31
36
|
|
data/spec/unit/module_spec.rb
CHANGED
@@ -93,146 +93,227 @@ describe Puppet::Module do
|
|
93
93
|
|
94
94
|
describe "when finding unmet dependencies" do
|
95
95
|
before do
|
96
|
-
|
97
|
-
@
|
98
|
-
|
99
|
-
"version_requirement" => ">= 2.2.0",
|
100
|
-
"name" => "baz/foobar"
|
101
|
-
}
|
102
|
-
]
|
96
|
+
FileTest.unstub(:exist?)
|
97
|
+
@modpath = tmpdir('modpath')
|
98
|
+
Puppet.settings[:modulepath] = @modpath
|
103
99
|
end
|
104
100
|
|
105
101
|
it "should list modules that are missing" do
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
102
|
+
mod = PuppetSpec::Modules.create(
|
103
|
+
'needy',
|
104
|
+
@modpath,
|
105
|
+
:metadata => {
|
106
|
+
:dependencies => [{
|
107
|
+
"version_requirement" => ">= 2.2.0",
|
108
|
+
"name" => "baz/foobar"
|
109
|
+
}]
|
110
|
+
}
|
111
|
+
)
|
112
|
+
mod.unmet_dependencies.should == [{
|
113
|
+
:reason => :missing,
|
114
|
+
:name => "baz/foobar",
|
115
|
+
:version_constraint => ">= 2.2.0",
|
116
|
+
:parent => { :name => 'puppetlabs/needy', :version => 'v9.9.9' },
|
117
|
+
:mod_details => { :installed_version => nil }
|
112
118
|
}]
|
113
119
|
end
|
114
120
|
|
115
|
-
it "should list modules
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
121
|
+
it "should list modules that are missing and have invalid names" do
|
122
|
+
mod = PuppetSpec::Modules.create(
|
123
|
+
'needy',
|
124
|
+
@modpath,
|
125
|
+
:metadata => {
|
126
|
+
:dependencies => [{
|
127
|
+
"version_requirement" => ">= 2.2.0",
|
128
|
+
"name" => "baz/foobar=bar"
|
129
|
+
}]
|
130
|
+
}
|
131
|
+
)
|
132
|
+
mod.unmet_dependencies.should == [{
|
133
|
+
:reason => :missing,
|
134
|
+
:name => "baz/foobar=bar",
|
135
|
+
:version_constraint => ">= 2.2.0",
|
136
|
+
:parent => { :name => 'puppetlabs/needy', :version => 'v9.9.9' },
|
137
|
+
:mod_details => { :installed_version => nil }
|
126
138
|
}]
|
127
139
|
end
|
128
140
|
|
129
|
-
it "should
|
130
|
-
mod =
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
141
|
+
it "should list modules with unmet version requirement" do
|
142
|
+
mod = PuppetSpec::Modules.create(
|
143
|
+
'foobar',
|
144
|
+
@modpath,
|
145
|
+
:metadata => {
|
146
|
+
:dependencies => [{
|
147
|
+
"version_requirement" => ">= 2.2.0",
|
148
|
+
"name" => "baz/foobar"
|
149
|
+
}]
|
150
|
+
}
|
151
|
+
)
|
152
|
+
mod2 = PuppetSpec::Modules.create(
|
153
|
+
'foobaz',
|
154
|
+
@modpath,
|
155
|
+
:metadata => {
|
156
|
+
:dependencies => [{
|
157
|
+
"version_requirement" => "1.0.0",
|
158
|
+
"name" => "baz/foobar"
|
159
|
+
}]
|
160
|
+
}
|
161
|
+
)
|
138
162
|
|
139
|
-
|
140
|
-
|
141
|
-
|
163
|
+
PuppetSpec::Modules.create(
|
164
|
+
'foobar',
|
165
|
+
@modpath,
|
166
|
+
:metadata => { :version => '2.0.0', :author => 'baz' }
|
167
|
+
)
|
142
168
|
|
143
|
-
|
144
|
-
:
|
145
|
-
:
|
146
|
-
|
147
|
-
|
148
|
-
|
169
|
+
mod.unmet_dependencies.should == [{
|
170
|
+
:reason => :version_mismatch,
|
171
|
+
:name => "baz/foobar",
|
172
|
+
:version_constraint => ">= 2.2.0",
|
173
|
+
:parent => { :version => "v9.9.9", :name => "puppetlabs/foobar" },
|
174
|
+
:mod_details => { :installed_version => "2.0.0" }
|
149
175
|
}]
|
150
|
-
end
|
151
176
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
:name => 'baz/foobar',
|
159
|
-
:error => <<-HEREDOC.gsub(/^\s{10}/, '')
|
160
|
-
Non semantic version dependency `foobar` (5.1):
|
161
|
-
`mymod` () requires `baz/foobar` (>= 2.2.0)
|
162
|
-
HEREDOC
|
177
|
+
mod2.unmet_dependencies.should == [{
|
178
|
+
:reason => :version_mismatch,
|
179
|
+
:name => "baz/foobar",
|
180
|
+
:version_constraint => "v1.0.0",
|
181
|
+
:parent => { :version => "v9.9.9", :name => "puppetlabs/foobaz" },
|
182
|
+
:mod_details => { :installed_version => "2.0.0" }
|
163
183
|
}]
|
184
|
+
|
164
185
|
end
|
165
186
|
|
166
|
-
it "should consider a dependency
|
167
|
-
|
168
|
-
|
187
|
+
it "should consider a dependency without a version requirement to be satisfied" do
|
188
|
+
mod = PuppetSpec::Modules.create(
|
189
|
+
'foobar',
|
190
|
+
@modpath,
|
191
|
+
:metadata => {
|
192
|
+
:dependencies => [{
|
193
|
+
"name" => "baz/foobar"
|
194
|
+
}]
|
195
|
+
}
|
196
|
+
)
|
197
|
+
PuppetSpec::Modules.create(
|
198
|
+
'foobar',
|
199
|
+
@modpath,
|
200
|
+
:metadata => {
|
201
|
+
:version => '2.0.0',
|
202
|
+
:author => 'baz'
|
203
|
+
}
|
204
|
+
)
|
205
|
+
|
206
|
+
mod.unmet_dependencies.should be_empty
|
207
|
+
end
|
169
208
|
|
170
|
-
|
171
|
-
mod
|
172
|
-
|
209
|
+
it "should consider a dependency without a semantic version to be unmet" do
|
210
|
+
mod = PuppetSpec::Modules.create(
|
211
|
+
'foobar',
|
212
|
+
@modpath,
|
213
|
+
:metadata => {
|
214
|
+
:dependencies => [{
|
215
|
+
"name" => "baz/foobar"
|
216
|
+
}]
|
217
|
+
}
|
218
|
+
)
|
219
|
+
PuppetSpec::Modules.create(
|
220
|
+
'foobar',
|
221
|
+
@modpath,
|
222
|
+
:metadata => {
|
223
|
+
:version => '5.1',
|
224
|
+
:author => 'baz'
|
225
|
+
}
|
226
|
+
)
|
173
227
|
|
174
228
|
mod.unmet_dependencies.should == [{
|
175
|
-
:
|
176
|
-
:
|
177
|
-
|
178
|
-
|
179
|
-
|
229
|
+
:reason => :non_semantic_version,
|
230
|
+
:parent => { :version => "v9.9.9", :name => "puppetlabs/foobar" },
|
231
|
+
:mod_details => { :installed_version => "5.1" },
|
232
|
+
:name => "baz/foobar",
|
233
|
+
:version_constraint => ">= 0.0.0"
|
180
234
|
}]
|
181
235
|
end
|
182
236
|
|
183
237
|
it "should have valid dependencies when no dependencies have been specified" do
|
184
|
-
mod =
|
238
|
+
mod = PuppetSpec::Modules.create(
|
239
|
+
'foobar',
|
240
|
+
@modpath,
|
241
|
+
:metadata => {
|
242
|
+
:dependencies => []
|
243
|
+
}
|
244
|
+
)
|
185
245
|
|
186
246
|
mod.unmet_dependencies.should == []
|
187
247
|
end
|
188
248
|
|
189
249
|
it "should only list unmet dependencies" do
|
190
|
-
mod =
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
250
|
+
mod = PuppetSpec::Modules.create(
|
251
|
+
'mymod',
|
252
|
+
@modpath,
|
253
|
+
:metadata => {
|
254
|
+
:dependencies => [
|
255
|
+
{
|
256
|
+
"version_requirement" => ">= 2.2.0",
|
257
|
+
"name" => "baz/satisfied"
|
258
|
+
},
|
259
|
+
{
|
260
|
+
"version_requirement" => ">= 2.2.0",
|
261
|
+
"name" => "baz/notsatisfied"
|
262
|
+
}
|
263
|
+
]
|
199
264
|
}
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
265
|
+
)
|
266
|
+
PuppetSpec::Modules.create(
|
267
|
+
'satisfied',
|
268
|
+
@modpath,
|
269
|
+
:metadata => {
|
270
|
+
:version => '3.3.0',
|
271
|
+
:author => 'baz'
|
272
|
+
}
|
273
|
+
)
|
207
274
|
|
208
275
|
mod.unmet_dependencies.should == [{
|
209
|
-
:
|
210
|
-
:
|
211
|
-
|
212
|
-
|
213
|
-
|
276
|
+
:reason => :missing,
|
277
|
+
:mod_details => { :installed_version => nil },
|
278
|
+
:parent => { :version => "v9.9.9", :name => "puppetlabs/mymod" },
|
279
|
+
:name => "baz/notsatisfied",
|
280
|
+
:version_constraint => ">= 2.2.0"
|
214
281
|
}]
|
215
282
|
end
|
216
283
|
|
217
284
|
it "should be empty when all dependencies are met" do
|
218
|
-
mod =
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
285
|
+
mod = PuppetSpec::Modules.create(
|
286
|
+
'mymod2',
|
287
|
+
@modpath,
|
288
|
+
:metadata => {
|
289
|
+
:dependencies => [
|
290
|
+
{
|
291
|
+
"version_requirement" => ">= 2.2.0",
|
292
|
+
"name" => "baz/satisfied"
|
293
|
+
},
|
294
|
+
{
|
295
|
+
"version_requirement" => "< 2.2.0",
|
296
|
+
"name" => "baz/alsosatisfied"
|
297
|
+
}
|
298
|
+
]
|
227
299
|
}
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
300
|
+
)
|
301
|
+
PuppetSpec::Modules.create(
|
302
|
+
'satisfied',
|
303
|
+
@modpath,
|
304
|
+
:metadata => {
|
305
|
+
:version => '3.3.0',
|
306
|
+
:author => 'baz'
|
307
|
+
}
|
308
|
+
)
|
309
|
+
PuppetSpec::Modules.create(
|
310
|
+
'alsosatisfied',
|
311
|
+
@modpath,
|
312
|
+
:metadata => {
|
313
|
+
:version => '2.1.0',
|
314
|
+
:author => 'baz'
|
315
|
+
}
|
316
|
+
)
|
236
317
|
|
237
318
|
mod.unmet_dependencies.should be_empty
|
238
319
|
end
|
@@ -386,6 +467,20 @@ describe Puppet::Module do
|
|
386
467
|
end
|
387
468
|
end
|
388
469
|
|
470
|
+
describe '#modulepath' do
|
471
|
+
it "should return the directory the module is installed in, if a path exists" do
|
472
|
+
mod = Puppet::Module.new("foo")
|
473
|
+
mod.stubs(:path).returns "/a/foo"
|
474
|
+
mod.modulepath.should == '/a'
|
475
|
+
end
|
476
|
+
|
477
|
+
it "should return nil if no path exists" do
|
478
|
+
mod = Puppet::Module.new("foo")
|
479
|
+
mod.stubs(:path).returns nil
|
480
|
+
mod.modulepath.should be_nil
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
389
484
|
it "should be considered existent if it exists in at least one module path" do
|
390
485
|
mod = Puppet::Module.new("foo")
|
391
486
|
mod.expects(:path).returns "/a/foo"
|
@@ -658,10 +753,48 @@ describe Puppet::Module do
|
|
658
753
|
@module.puppetversion.should == @data[:puppetversion]
|
659
754
|
end
|
660
755
|
|
756
|
+
context "when versionRequirement is used for dependency version info" do
|
757
|
+
before do
|
758
|
+
@data = {
|
759
|
+
:license => "GPL2",
|
760
|
+
:author => "luke",
|
761
|
+
:version => "1.0",
|
762
|
+
:source => "http://foo/",
|
763
|
+
:puppetversion => "0.25",
|
764
|
+
:dependencies => [
|
765
|
+
{
|
766
|
+
"versionRequirement" => "0.0.1",
|
767
|
+
"name" => "pmtacceptance/stdlib"
|
768
|
+
},
|
769
|
+
{
|
770
|
+
"versionRequirement" => "0.1.0",
|
771
|
+
"name" => "pmtacceptance/apache"
|
772
|
+
}
|
773
|
+
]
|
774
|
+
}
|
775
|
+
@text = @data.to_pson
|
776
|
+
|
777
|
+
@module = Puppet::Module.new("foo")
|
778
|
+
@module.stubs(:metadata_file).returns "/my/file"
|
779
|
+
File.stubs(:read).with("/my/file").returns @text
|
780
|
+
end
|
781
|
+
|
782
|
+
it "should set the dependency version_requirement key" do
|
783
|
+
@module.load_metadata
|
784
|
+
@module.dependencies[0]['version_requirement'].should == "0.0.1"
|
785
|
+
end
|
786
|
+
|
787
|
+
it "should set the version_requirement key for all dependencies" do
|
788
|
+
@module.load_metadata
|
789
|
+
@module.dependencies[0]['version_requirement'].should == "0.0.1"
|
790
|
+
@module.dependencies[1]['version_requirement'].should == "0.1.0"
|
791
|
+
end
|
792
|
+
end
|
793
|
+
|
661
794
|
it "should fail if the discovered name is different than the metadata name"
|
662
795
|
end
|
663
796
|
|
664
|
-
it "should be able to tell if there are local changes" do
|
797
|
+
it "should be able to tell if there are local changes", :fails_on_windows => true do
|
665
798
|
modpath = tmpdir('modpath')
|
666
799
|
foo_checksum = 'acbd18db4cc2f85cedef654fccc4a4d8'
|
667
800
|
checksummed_module = PuppetSpec::Modules.create(
|
@@ -677,12 +810,12 @@ describe Puppet::Module do
|
|
677
810
|
foo_path = Pathname.new(File.join(checksummed_module.path, 'foo'))
|
678
811
|
|
679
812
|
IO.binwrite(foo_path, 'notfoo')
|
680
|
-
Puppet::
|
813
|
+
Puppet::ModuleTool::Checksums.new(foo_path).checksum(foo_path).should_not == foo_checksum
|
681
814
|
checksummed_module.has_local_changes?.should be_true
|
682
815
|
|
683
816
|
IO.binwrite(foo_path, 'foo')
|
684
817
|
|
685
|
-
Puppet::
|
818
|
+
Puppet::ModuleTool::Checksums.new(foo_path).checksum(foo_path).should == foo_checksum
|
686
819
|
checksummed_module.has_local_changes?.should be_false
|
687
820
|
end
|
688
821
|
|