Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/puppet/type/yumrepo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ def flush
newvalue(/^(0|1)$/) { }
end

newproperty(:repo_gpgcheck, :parent => Puppet::IniProperty) do
desc "Whether to check the GPG signature on repodata
, as represented by a `0` or `1`.
#{ABSENT_DOC}"
newvalue(:absent) { self.should = :absent }
newvalue(/^(0|1)$/) { }
end

newproperty(:gpgkey, :parent => Puppet::IniProperty) do
desc "The URL for the GPG key with which packages from this
repository are signed. #{ABSENT_DOC}"
Expand Down
11 changes: 7 additions & 4 deletions spec/unit/type/yumrepo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Puppet::Type.type(:yumrepo).new(:name => "puppetlabs")[:name].should == "puppetlabs"
end

[:baseurl, :cost, :descr, :enabled, :enablegroups, :exclude, :failovermethod, :gpgcheck, :gpgkey, :http_caching,
[:baseurl, :cost, :descr, :enabled, :enablegroups, :exclude, :failovermethod, :gpgcheck, :repo_gpgcheck, :gpgkey, :http_caching,
:include, :includepkgs, :keepalive, :metadata_expire, :mirrorlist, :priority, :protect, :proxy, :proxy_username, :proxy_password, :timeout,
:sslcacert, :sslverify, :sslclientcert, :sslclientkey, :s3_enabled].each do |param|
it "should have a '#{param}' parameter" do
Expand All @@ -20,19 +20,19 @@
end

describe "When validating attribute values" do
[:cost, :enabled, :enablegroups, :failovermethod, :gpgcheck, :http_caching, :keepalive, :metadata_expire, :priority, :protect, :timeout].each do |param|
[:cost, :enabled, :enablegroups, :failovermethod, :gpgcheck, :repo_gpgcheck, :http_caching, :keepalive, :metadata_expire, :priority, :protect, :timeout].each do |param|
it "should support :absent as a value to '#{param}' parameter" do
Puppet::Type.type(:yumrepo).new(:name => "puppetlabs.repo", param => :absent)
end
end

[:cost, :enabled, :enablegroups, :gpgcheck, :keepalive, :metadata_expire, :priority, :protect, :timeout].each do |param|
[:cost, :enabled, :enablegroups, :gpgcheck, :repo_gpgcheck, :keepalive, :metadata_expire, :priority, :protect, :timeout].each do |param|
it "should fail if '#{param}' is not a number" do
lambda { Puppet::Type.type(:yumrepo).new(:name => "puppetlabs", param => "notanumber") }.should raise_error
end
end

[:enabled, :enabledgroups, :gpgcheck, :keepalive, :protect, :s3_enabled].each do |param|
[:enabled, :enabledgroups, :gpgcheck, :repo_gpgcheck, :keepalive, :protect, :s3_enabled].each do |param|
it "should fail if '#{param}' does not have one of the following values (0|1)" do
lambda { Puppet::Type.type(:yumrepo).new(:name => "puppetlabs", param => "2") }.should raise_error
end
Expand Down Expand Up @@ -97,6 +97,7 @@ def create_data_files()
:baseurl => "http://example.com/yum/$releasever/$basearch/os/",
:enabled => "1",
:gpgcheck => "1",
:repo_gpgcheck => "1",
:includepkgs => "absent",
:gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora",
:proxy => "http://proxy.example.com:80/",
Expand Down Expand Up @@ -175,6 +176,7 @@ def create_data_files()
baseurl=http://example.com/yum/$releasever/$basearch/os/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
proxy=http://proxy.example.com:80/
proxy_username=username
Expand All @@ -187,6 +189,7 @@ def create_data_files()
mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-$releasever
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
exclude=foo
bar
Expand Down