puppet 3.5.0.rc3 → 3.5.1.rc1
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/lib/puppet.rb +11 -2
- data/lib/puppet/defaults.rb +3 -2
- data/lib/puppet/environments.rb +16 -0
- data/lib/puppet/network/http/api/v1.rb +6 -2
- data/lib/puppet/network/http/issues.rb +1 -0
- data/lib/puppet/node/environment.rb +9 -5
- data/lib/puppet/pops/parser/interpolation_support.rb +8 -4
- data/lib/puppet/provider/yumrepo/inifile.rb +60 -20
- data/lib/puppet/test/test_helper.rb +1 -8
- data/lib/puppet/type/yumrepo.rb +43 -9
- data/lib/puppet/util/inifile.rb +209 -86
- data/lib/puppet/version.rb +1 -1
- data/spec/integration/application/apply_spec.rb +3 -1
- data/spec/integration/directory_environments_spec.rb +2 -1
- data/spec/integration/indirector/file_content/file_server_spec.rb +1 -1
- data/spec/integration/node/environment_spec.rb +2 -2
- data/spec/integration/resource/type_collection_spec.rb +1 -1
- data/spec/unit/application/apply_spec.rb +1 -1
- data/spec/unit/environments_spec.rb +35 -36
- data/spec/unit/face/module/install_spec.rb +1 -1
- data/spec/unit/face/module/list_spec.rb +3 -3
- data/spec/unit/face/module/uninstall_spec.rb +1 -1
- data/spec/unit/face/parser_spec.rb +1 -1
- data/spec/unit/indirector/node/active_record_spec.rb +1 -1
- data/spec/unit/indirector/node/ldap_spec.rb +4 -4
- data/spec/unit/indirector/node/plain_spec.rb +1 -1
- data/spec/unit/indirector/request_spec.rb +3 -3
- data/spec/unit/module_spec.rb +6 -6
- data/spec/unit/module_tool/applications/installer_spec.rb +1 -1
- data/spec/unit/module_tool/applications/uninstaller_spec.rb +1 -1
- data/spec/unit/module_tool_spec.rb +1 -1
- data/spec/unit/network/http/api/v1_spec.rb +11 -1
- data/spec/unit/network/http/api/v2/environments_spec.rb +1 -1
- data/spec/unit/node/environment_spec.rb +1 -1
- data/spec/unit/node_spec.rb +1 -1
- data/spec/unit/parser/ast/collection_spec.rb +1 -1
- data/spec/unit/parser/compiler_spec.rb +1 -1
- data/spec/unit/parser/files_spec.rb +2 -2
- data/spec/unit/parser/functions_spec.rb +2 -2
- data/spec/unit/parser/parser_spec.rb +2 -2
- data/spec/unit/parser/resource_spec.rb +1 -1
- data/spec/unit/parser/scope_spec.rb +3 -3
- data/spec/unit/pops/parser/lexer2_spec.rb +11 -0
- data/spec/unit/pops/parser/parse_heredoc_spec.rb +15 -1
- data/spec/unit/provider/yumrepo/inifile_spec.rb +71 -23
- data/spec/unit/rails/host_spec.rb +1 -1
- data/spec/unit/resource/type_collection_spec.rb +1 -1
- data/spec/unit/resource/type_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +1 -1
- data/spec/unit/type/yumrepo_spec.rb +214 -49
- data/spec/unit/util/autoload_spec.rb +1 -1
- data/spec/unit/util/inifile_spec.rb +492 -0
- data/spec/unit/util/rdoc/parser_spec.rb +2 -2
- metadata +3009 -3030
@@ -66,7 +66,7 @@ describe Puppet::Parser::Compiler do
|
|
66
66
|
now = Time.now
|
67
67
|
Time.stubs(:now).returns(now)
|
68
68
|
|
69
|
-
environment = Puppet::Node::Environment.create(:testing, []
|
69
|
+
environment = Puppet::Node::Environment.create(:testing, [])
|
70
70
|
@node = Puppet::Node.new("testnode",
|
71
71
|
:facts => Puppet::Node::Facts.new("facts", {}),
|
72
72
|
:environment => environment)
|
@@ -6,7 +6,7 @@ require 'puppet/parser/files'
|
|
6
6
|
describe Puppet::Parser::Files do
|
7
7
|
include PuppetSpec::Files
|
8
8
|
|
9
|
-
let(:environment) { Puppet::Node::Environment.create(:testing, []
|
9
|
+
let(:environment) { Puppet::Node::Environment.create(:testing, []) }
|
10
10
|
|
11
11
|
before do
|
12
12
|
@basepath = make_absolute("/somepath")
|
@@ -140,7 +140,7 @@ describe Puppet::Parser::Files do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
it "does not find the module when it is a different environment" do
|
143
|
-
different_env = Puppet::Node::Environment.create(:different, []
|
143
|
+
different_env = Puppet::Node::Environment.create(:different, [])
|
144
144
|
a_module_in_environment(environment, "mymod")
|
145
145
|
|
146
146
|
Puppet::Parser::Files.find_manifests_in_modules("mymod/init.pp", different_env).should_not include("mymod")
|
@@ -8,7 +8,7 @@ describe Puppet::Parser::Functions do
|
|
8
8
|
|
9
9
|
let(:function_module) { Puppet::Parser::Functions.environment_module(Puppet.lookup(:current_environment)) }
|
10
10
|
|
11
|
-
let(:environment) { Puppet::Node::Environment.create(:myenv, []
|
11
|
+
let(:environment) { Puppet::Node::Environment.create(:myenv, []) }
|
12
12
|
|
13
13
|
before do
|
14
14
|
Puppet::Parser::Functions.reset
|
@@ -72,7 +72,7 @@ describe Puppet::Parser::Functions do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
Puppet.override(:current_environment => Puppet::Node::Environment.create(:other, []
|
75
|
+
Puppet.override(:current_environment => Puppet::Node::Environment.create(:other, [])) do
|
76
76
|
Puppet::Parser::Functions.newfunction("other_env", :type => :rvalue) do |args|
|
77
77
|
end
|
78
78
|
|
@@ -19,12 +19,12 @@ describe Puppet::Parser do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should set the environment" do
|
22
|
-
env = Puppet::Node::Environment.create(:testing, []
|
22
|
+
env = Puppet::Node::Environment.create(:testing, [])
|
23
23
|
Puppet::Parser::Parser.new(env).environment.should == env
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should be able to look up the environment-specific resource type collection" do
|
27
|
-
env = Puppet::Node::Environment.create(:development, []
|
27
|
+
env = Puppet::Node::Environment.create(:development, [])
|
28
28
|
rtc = env.known_resource_types
|
29
29
|
parser = Puppet::Parser::Parser.new env
|
30
30
|
parser.known_resource_types.should equal(rtc)
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Puppet::Parser::Resource do
|
4
4
|
before do
|
5
|
-
environment = Puppet::Node::Environment.create(:testing, []
|
5
|
+
environment = Puppet::Node::Environment.create(:testing, [])
|
6
6
|
@node = Puppet::Node.new("yaynode", :environment => environment)
|
7
7
|
@known_resource_types = environment.known_resource_types
|
8
8
|
@compiler = Puppet::Parser::Compiler.new(@node)
|
@@ -64,7 +64,7 @@ describe Puppet::Parser::Scope do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should get its environment from its compiler" do
|
67
|
-
env = Puppet::Node::Environment.create(:testing, []
|
67
|
+
env = Puppet::Node::Environment.create(:testing, [])
|
68
68
|
compiler = stub 'compiler', :environment => env, :is_a? => true
|
69
69
|
scope = Puppet::Parser::Scope.new(compiler)
|
70
70
|
scope.environment.should equal(env)
|
@@ -87,7 +87,7 @@ describe Puppet::Parser::Scope do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
describe "when custom functions are called" do
|
90
|
-
let(:env) { Puppet::Node::Environment.create(:testing, []
|
90
|
+
let(:env) { Puppet::Node::Environment.create(:testing, []) }
|
91
91
|
let(:compiler) { Puppet::Parser::Compiler.new(Puppet::Node.new('foo', :environment => env)) }
|
92
92
|
let(:scope) { Puppet::Parser::Scope.new(compiler) }
|
93
93
|
|
@@ -120,7 +120,7 @@ describe Puppet::Parser::Scope do
|
|
120
120
|
|
121
121
|
describe "when initializing" do
|
122
122
|
it "should extend itself with its environment's Functions module as well as the default" do
|
123
|
-
env = Puppet::Node::Environment.create(:myenv, []
|
123
|
+
env = Puppet::Node::Environment.create(:myenv, [])
|
124
124
|
root = Puppet.lookup(:root_environment)
|
125
125
|
compiler = stub 'compiler', :environment => env, :is_a? => true
|
126
126
|
|
@@ -208,6 +208,17 @@ describe 'Lexer2' do
|
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
|
+
{ '"$"' => '$',
|
212
|
+
'"a$"' => 'a$',
|
213
|
+
'"a$%b"' => "a$%b",
|
214
|
+
'"a$$"' => "a$$",
|
215
|
+
'"a$$%"' => "a$$%",
|
216
|
+
}.each do |source, expected|
|
217
|
+
it "should lex interpolation including false starts #{source}" do
|
218
|
+
tokens_scanned_from(source).should match_tokens2([:STRING, expected])
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
211
222
|
it "differentiates between foo[x] and foo [x] (whitespace)" do
|
212
223
|
tokens_scanned_from("$a[1]").should match_tokens2(:VARIABLE, :LBRACK, :NUMBER, :RBRACK)
|
213
224
|
tokens_scanned_from("$a [1]").should match_tokens2(:VARIABLE, :LBRACK, :NUMBER, :RBRACK)
|
@@ -58,7 +58,7 @@ describe "egrammar parsing heredoc" do
|
|
58
58
|
].join("\n")
|
59
59
|
end
|
60
60
|
|
61
|
-
it "parses interpolated heredoc
|
61
|
+
it "parses interpolated heredoc expression" do
|
62
62
|
src = <<-CODE
|
63
63
|
@("END")
|
64
64
|
Hello $name
|
@@ -70,4 +70,18 @@ describe "egrammar parsing heredoc" do
|
|
70
70
|
")"
|
71
71
|
].join("\n")
|
72
72
|
end
|
73
|
+
|
74
|
+
it "parses interpolated heredoc expression with false start on $" do
|
75
|
+
src = <<-CODE
|
76
|
+
@("END")
|
77
|
+
Hello $name$%a
|
78
|
+
|- END
|
79
|
+
CODE
|
80
|
+
dump(parse(src)).should == [
|
81
|
+
"(@()",
|
82
|
+
" (sublocated (cat 'Hello ' (str $name) '$%a'))",
|
83
|
+
")"
|
84
|
+
].join("\n")
|
85
|
+
end
|
86
|
+
|
73
87
|
end
|
@@ -10,24 +10,28 @@ describe Puppet::Type.type(:yumrepo).provider(:inifile) do
|
|
10
10
|
|
11
11
|
describe 'self.instances' do
|
12
12
|
let(:updates_section) do
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
sect = Puppet::Util::IniConfig::Section.new('updates', '/some/imaginary/file')
|
14
|
+
sect.entries << ['name', 'Some long description of the repo']
|
15
|
+
sect.entries << ['enabled', '1']
|
16
|
+
|
17
|
+
sect
|
16
18
|
end
|
17
19
|
|
18
20
|
it 'finds any existing sections' do
|
19
21
|
virtual_inifile.expects(:each_section).yields(updates_section)
|
22
|
+
virtual_inifile.stubs(:[]).with('updates').returns(updates_section)
|
20
23
|
|
21
24
|
providers = described_class.instances
|
22
25
|
providers.should have(1).items
|
23
26
|
providers[0].name.should == 'updates'
|
27
|
+
providers[0].descr.should == 'Some long description of the repo'
|
24
28
|
providers[0].enabled.should == '1'
|
25
29
|
end
|
26
30
|
end
|
27
31
|
|
28
|
-
describe "
|
32
|
+
describe "setting and getting properties" do
|
29
33
|
|
30
|
-
let(:
|
34
|
+
let(:type_instance) do
|
31
35
|
Puppet::Type.type(:yumrepo).new(
|
32
36
|
:name => 'puppetlabs-products',
|
33
37
|
:ensure => :present,
|
@@ -39,31 +43,75 @@ describe Puppet::Type.type(:yumrepo).provider(:inifile) do
|
|
39
43
|
)
|
40
44
|
end
|
41
45
|
|
42
|
-
let(:provider)
|
46
|
+
let(:provider) do
|
47
|
+
described_class.new(type_instance)
|
48
|
+
end
|
43
49
|
|
44
|
-
let(:
|
50
|
+
let(:section) do
|
51
|
+
stub('inifile puppetlabs section', :name => 'puppetlabs-products')
|
52
|
+
end
|
45
53
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
puppetlabs_section.expects(:[]=).with('enabled', '1')
|
51
|
-
puppetlabs_section.expects(:[]=).with('gpgcheck', '1')
|
52
|
-
puppetlabs_section.expects(:[]=).with('gpgkey', 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs')
|
54
|
+
before do
|
55
|
+
type_instance.provider = provider
|
56
|
+
described_class.stubs(:section).with('puppetlabs-products').returns(section)
|
57
|
+
end
|
53
58
|
|
54
|
-
|
59
|
+
describe "methods used by ensurable" do
|
60
|
+
it "#create sets the yumrepo properties on the according section" do
|
61
|
+
section.expects(:[]=).with('baseurl', 'http://yum.puppetlabs.com/el/6/products/$basearch')
|
62
|
+
section.expects(:[]=).with('name', 'Puppet Labs Products El 6 - $basearch')
|
63
|
+
section.expects(:[]=).with('enabled', '1')
|
64
|
+
section.expects(:[]=).with('gpgcheck', '1')
|
65
|
+
section.expects(:[]=).with('gpgkey', 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs')
|
66
|
+
|
67
|
+
provider.create
|
68
|
+
end
|
69
|
+
|
70
|
+
it "#exists? checks if the repo has been marked as present" do
|
71
|
+
described_class.stubs(:section).returns(stub(:[]= => nil))
|
72
|
+
provider.create
|
73
|
+
expect(provider).to be_exist
|
74
|
+
end
|
75
|
+
|
76
|
+
it "#destroy deletes the associated ini file section" do
|
77
|
+
described_class.expects(:section).returns(section)
|
78
|
+
section.expects(:destroy=).with(true)
|
79
|
+
provider.destroy
|
80
|
+
end
|
55
81
|
end
|
56
82
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
83
|
+
describe "getting properties" do
|
84
|
+
it "maps the 'descr' property to the 'name' INI property" do
|
85
|
+
section.expects(:[]).with('name').returns 'Some rather long description of the repository'
|
86
|
+
expect(provider.descr).to eq 'Some rather long description of the repository'
|
87
|
+
end
|
88
|
+
|
89
|
+
it "gets the property from the INI section" do
|
90
|
+
section.expects(:[]).with('enabled').returns '1'
|
91
|
+
expect(provider.enabled).to eq '1'
|
92
|
+
end
|
93
|
+
|
94
|
+
it "sets the property as :absent if the INI property is nil" do
|
95
|
+
section.expects(:[]).with('exclude').returns nil
|
96
|
+
expect(provider.exclude).to eq :absent
|
97
|
+
end
|
61
98
|
end
|
62
99
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
100
|
+
describe "setting properties" do
|
101
|
+
it "maps the 'descr' property to the 'name' INI property" do
|
102
|
+
section.expects(:[]=).with('name', 'Some rather long description of the repository')
|
103
|
+
provider.descr = 'Some rather long description of the repository'
|
104
|
+
end
|
105
|
+
|
106
|
+
it "sets the property on the INI section" do
|
107
|
+
section.expects(:[]=).with('enabled', '0')
|
108
|
+
provider.enabled = '0'
|
109
|
+
end
|
110
|
+
|
111
|
+
it "sets the section field to nil when the specified value is absent" do
|
112
|
+
section.expects(:[]=).with('exclude', nil)
|
113
|
+
provider.exclude = :absent
|
114
|
+
end
|
67
115
|
end
|
68
116
|
end
|
69
117
|
|
@@ -40,7 +40,7 @@ describe "Puppet::Rails::Host", :if => can_use_scratch_database? do
|
|
40
40
|
|
41
41
|
it "should stringify the environment" do
|
42
42
|
host = Puppet::Rails::Host.new
|
43
|
-
host.environment = Puppet::Node::Environment.create(:production, []
|
43
|
+
host.environment = Puppet::Node::Environment.create(:production, [])
|
44
44
|
host.environment.class.should == String
|
45
45
|
end
|
46
46
|
|
@@ -7,7 +7,7 @@ require 'puppet/resource/type'
|
|
7
7
|
describe Puppet::Resource::TypeCollection do
|
8
8
|
include PuppetSpec::Files
|
9
9
|
|
10
|
-
let(:environment) { Puppet::Node::Environment.create(:testing, []
|
10
|
+
let(:environment) { Puppet::Node::Environment.create(:testing, []) }
|
11
11
|
|
12
12
|
before do
|
13
13
|
@instance = Puppet::Resource::Type.new(:hostclass, "foo")
|
@@ -347,7 +347,7 @@ describe Puppet::Resource::Type do
|
|
347
347
|
|
348
348
|
describe "when describing and managing parent classes" do
|
349
349
|
before do
|
350
|
-
environment = Puppet::Node::Environment.create(:testing, []
|
350
|
+
environment = Puppet::Node::Environment.create(:testing, [])
|
351
351
|
@krt = environment.known_resource_types
|
352
352
|
@parent = Puppet::Resource::Type.new(:hostclass, "bar")
|
353
353
|
@krt.add @parent
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe Puppet::Resource do
|
|
6
6
|
include PuppetSpec::Files
|
7
7
|
|
8
8
|
let(:basepath) { make_absolute("/somepath") }
|
9
|
-
let(:environment) { Puppet::Node::Environment.create(:testing, []
|
9
|
+
let(:environment) { Puppet::Node::Environment.create(:testing, []) }
|
10
10
|
|
11
11
|
[:catalog, :file, :line].each do |attr|
|
12
12
|
it "should have an #{attr} attribute" do
|
@@ -1,78 +1,243 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'puppet'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}
|
4
|
+
shared_examples_for "a yumrepo parameter that can be absent" do |param|
|
5
|
+
it "can be set as :absent" do
|
6
|
+
described_class.new(:name => 'puppetlabs', param => :absent)
|
7
|
+
end
|
8
|
+
end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
yumrepo[:name].should == "puppetlabs"
|
14
|
-
end
|
10
|
+
shared_examples_for "a yumrepo parameter that expects a boolean parameter" do |param|
|
11
|
+
valid_values = %w[True False 0 1 No Yes]
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
valid_values.each do |value|
|
14
|
+
it "accepts a valid value of #{value}" do
|
15
|
+
instance = described_class.new(:name => 'puppetlabs', param => value)
|
16
|
+
expect(instance[param]).to eq value
|
17
|
+
end
|
18
|
+
it "accepts #{value} downcased to #{value.downcase}" do
|
19
|
+
instance = described_class.new(:name => 'puppetlabs', param => value.downcase)
|
20
|
+
expect(instance[param]).to eq value.downcase
|
24
21
|
end
|
25
22
|
end
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
it "rejects invalid boolean values" do
|
25
|
+
expect {
|
26
|
+
described_class.new(:name => 'puppetlabs', param => 'flase')
|
27
|
+
}.to raise_error(Puppet::ResourceError, /Parameter #{param} failed/)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
shared_examples_for "a yumrepo parameter that accepts a single URL" do |param|
|
32
|
+
it "can accept a single URL" do
|
33
|
+
described_class.new(
|
34
|
+
:name => 'puppetlabs',
|
35
|
+
param => 'http://localhost/yumrepos'
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "fails if an invalid URL is provided" do
|
40
|
+
expect {
|
41
|
+
described_class.new(
|
42
|
+
:name => 'puppetlabs',
|
43
|
+
param => "that's no URL!"
|
44
|
+
)
|
45
|
+
}.to raise_error(Puppet::ResourceError, /Parameter #{param} failed/)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "fails if a valid URL uses an invalid URI scheme" do
|
49
|
+
expect {
|
50
|
+
described_class.new(
|
51
|
+
:name => 'puppetlabs',
|
52
|
+
param => 'ldap://localhost/yumrepos'
|
53
|
+
)
|
54
|
+
}.to raise_error(Puppet::ResourceError, /Parameter #{param} failed/)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
shared_examples_for "a yumrepo parameter that accepts multiple URLs" do |param|
|
59
|
+
it "can accept multiple URLs" do
|
60
|
+
described_class.new(
|
61
|
+
:name => 'puppetlabs',
|
62
|
+
param => 'http://localhost/yumrepos http://localhost/more-yumrepos'
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "fails if multiple URLs are given and one is invalid" do
|
67
|
+
expect {
|
68
|
+
described_class.new(
|
69
|
+
:name => 'puppetlabs',
|
70
|
+
param => "http://localhost/yumrepos That's no URL!"
|
71
|
+
)
|
72
|
+
}.to raise_error(Puppet::ResourceError, /Parameter #{param} failed/)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe Puppet::Type.type(:yumrepo) do
|
77
|
+
it "has :name as its namevar" do
|
78
|
+
expect(described_class.key_attributes).to eq [:name]
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "validating" do
|
82
|
+
|
83
|
+
describe "name" do
|
84
|
+
it "is a valid parameter" do
|
85
|
+
instance = described_class.new(:name => 'puppetlabs')
|
86
|
+
expect(instance.name).to eq 'puppetlabs'
|
32
87
|
end
|
33
88
|
end
|
34
89
|
|
35
|
-
|
36
|
-
|
37
|
-
it "should fail if '#{param}' is not true/false, 0/1, or yes/no" do
|
38
|
-
expect { Puppet::Type.type(:yumrepo).new(:name => "puppetlabs", param => "notanumber") }.to raise_error
|
39
|
-
end
|
90
|
+
describe "target" do
|
91
|
+
it_behaves_like "a yumrepo parameter that can be absent", :target
|
40
92
|
end
|
41
93
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
94
|
+
describe "descr" do
|
95
|
+
it_behaves_like "a yumrepo parameter that can be absent", :descr
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "mirrorlist" do
|
99
|
+
it_behaves_like "a yumrepo parameter that accepts a single URL", :mirrorlist
|
100
|
+
it_behaves_like "a yumrepo parameter that can be absent", :mirrorlist
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "baseurl" do
|
104
|
+
it_behaves_like "a yumrepo parameter that can be absent", :baseurl
|
105
|
+
it_behaves_like "a yumrepo parameter that accepts a single URL", :baseurl
|
106
|
+
it_behaves_like "a yumrepo parameter that accepts multiple URLs", :baseurl
|
107
|
+
end
|
108
|
+
|
109
|
+
describe "enabled" do
|
110
|
+
it_behaves_like "a yumrepo parameter that expects a boolean parameter", :enabled
|
111
|
+
it_behaves_like "a yumrepo parameter that can be absent", :enabled
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "gpgcheck" do
|
115
|
+
it_behaves_like "a yumrepo parameter that expects a boolean parameter", :gpgcheck
|
116
|
+
it_behaves_like "a yumrepo parameter that can be absent", :gpgcheck
|
117
|
+
end
|
118
|
+
|
119
|
+
describe "repo_gpgcheck" do
|
120
|
+
it_behaves_like "a yumrepo parameter that expects a boolean parameter", :repo_gpgcheck
|
121
|
+
it_behaves_like "a yumrepo parameter that can be absent", :repo_gpgcheck
|
122
|
+
end
|
123
|
+
|
124
|
+
describe "gpgkey" do
|
125
|
+
it_behaves_like "a yumrepo parameter that can be absent", :gpgkey
|
126
|
+
it_behaves_like "a yumrepo parameter that accepts a single URL", :gpgkey
|
127
|
+
it_behaves_like "a yumrepo parameter that accepts multiple URLs", :gpgkey
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "include" do
|
131
|
+
it_behaves_like "a yumrepo parameter that can be absent", :include
|
132
|
+
it_behaves_like "a yumrepo parameter that accepts a single URL", :include
|
46
133
|
end
|
47
134
|
|
48
|
-
|
49
|
-
|
135
|
+
describe "exclude" do
|
136
|
+
it_behaves_like "a yumrepo parameter that can be absent", :exclude
|
50
137
|
end
|
51
138
|
|
52
|
-
|
53
|
-
|
139
|
+
describe "includepkgs" do
|
140
|
+
it_behaves_like "a yumrepo parameter that can be absent", :includepkgs
|
54
141
|
end
|
55
142
|
|
56
|
-
|
57
|
-
|
143
|
+
describe "enablegroups" do
|
144
|
+
it_behaves_like "a yumrepo parameter that expects a boolean parameter", :enablegroups
|
145
|
+
it_behaves_like "a yumrepo parameter that can be absent", :enablegroups
|
146
|
+
end
|
147
|
+
|
148
|
+
describe "failovermethod" do
|
149
|
+
|
150
|
+
%w[roundrobin priority].each do |value|
|
151
|
+
it "accepts a value of #{value}" do
|
152
|
+
described_class.new(:name => "puppetlabs", :failovermethod => value)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
it "raises an error if an invalid value is given" do
|
157
|
+
expect {
|
158
|
+
described_class.new(:name => "puppetlabs", :failovermethod => "notavalidvalue")
|
159
|
+
}.to raise_error(Puppet::ResourceError, /Parameter failovermethod failed/)
|
160
|
+
end
|
161
|
+
|
162
|
+
it_behaves_like "a yumrepo parameter that can be absent", :failovermethod
|
58
163
|
end
|
59
164
|
|
60
|
-
|
61
|
-
|
62
|
-
|
165
|
+
describe "keepalive" do
|
166
|
+
it_behaves_like "a yumrepo parameter that expects a boolean parameter", :keepalive
|
167
|
+
it_behaves_like "a yumrepo parameter that can be absent", :keepalive
|
63
168
|
end
|
64
169
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
Puppet::Type.type(:yumrepo).new(:name => "puppetlabs", param => "ftp://example.com/")[param].should =~ %r{\Aftp://}
|
170
|
+
describe "http_caching" do
|
171
|
+
%w[packages all none].each do |value|
|
172
|
+
it "accepts a valid value of #{value}" do
|
173
|
+
described_class.new(:name => 'puppetlabs', :http_caching => value)
|
174
|
+
end
|
71
175
|
end
|
72
176
|
|
73
|
-
it "
|
74
|
-
expect {
|
177
|
+
it "rejects invalid values" do
|
178
|
+
expect {
|
179
|
+
described_class.new(:name => 'puppetlabs', :http_caching => 'yes')
|
180
|
+
}.to raise_error(Puppet::ResourceError, /Parameter http_caching failed/)
|
75
181
|
end
|
182
|
+
|
183
|
+
it_behaves_like "a yumrepo parameter that can be absent", :http_caching
|
184
|
+
end
|
185
|
+
|
186
|
+
describe "timeout" do
|
187
|
+
it_behaves_like "a yumrepo parameter that can be absent", :timeout
|
188
|
+
end
|
189
|
+
|
190
|
+
describe "metadata_expire" do
|
191
|
+
it_behaves_like "a yumrepo parameter that can be absent", :metadata_expire
|
192
|
+
end
|
193
|
+
|
194
|
+
describe "protect" do
|
195
|
+
it_behaves_like "a yumrepo parameter that expects a boolean parameter", :protect
|
196
|
+
it_behaves_like "a yumrepo parameter that can be absent", :protect
|
197
|
+
end
|
198
|
+
|
199
|
+
describe "priority" do
|
200
|
+
it_behaves_like "a yumrepo parameter that can be absent", :priority
|
201
|
+
end
|
202
|
+
|
203
|
+
describe "proxy" do
|
204
|
+
it_behaves_like "a yumrepo parameter that can be absent", :proxy
|
205
|
+
it_behaves_like "a yumrepo parameter that accepts a single URL", :proxy
|
206
|
+
end
|
207
|
+
|
208
|
+
describe "proxy_username" do
|
209
|
+
it_behaves_like "a yumrepo parameter that can be absent", :proxy_username
|
210
|
+
end
|
211
|
+
|
212
|
+
describe "proxy_password" do
|
213
|
+
it_behaves_like "a yumrepo parameter that can be absent", :proxy_password
|
214
|
+
end
|
215
|
+
|
216
|
+
describe "s3_enabled" do
|
217
|
+
it_behaves_like "a yumrepo parameter that expects a boolean parameter", :s3_enabled
|
218
|
+
it_behaves_like "a yumrepo parameter that can be absent", :s3_enabled
|
219
|
+
end
|
220
|
+
|
221
|
+
describe "sslcacert" do
|
222
|
+
it_behaves_like "a yumrepo parameter that can be absent", :sslcacert
|
223
|
+
end
|
224
|
+
|
225
|
+
describe "sslverify" do
|
226
|
+
it_behaves_like "a yumrepo parameter that expects a boolean parameter", :sslverify
|
227
|
+
it_behaves_like "a yumrepo parameter that can be absent", :sslverify
|
228
|
+
end
|
229
|
+
|
230
|
+
describe "sslclientcert" do
|
231
|
+
it_behaves_like "a yumrepo parameter that can be absent", :sslclientcert
|
232
|
+
end
|
233
|
+
|
234
|
+
describe "sslclientkey" do
|
235
|
+
it_behaves_like "a yumrepo parameter that can be absent", :sslclientkey
|
236
|
+
end
|
237
|
+
|
238
|
+
describe "metalink" do
|
239
|
+
it_behaves_like "a yumrepo parameter that can be absent", :metalink
|
240
|
+
it_behaves_like "a yumrepo parameter that accepts a single URL", :metalink
|
76
241
|
end
|
77
242
|
end
|
78
243
|
end
|