Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
immerda
Puppet Modules
rpmkey
Commits
e9ed59f6
Commit
e9ed59f6
authored
Feb 01, 2015
by
Stefan Schulte
Browse files
Merge remote-tracking branch 'duritong/autorequire'
* duritong/autorequire: autorequire a local source
parents
16e403c7
69acb925
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/puppet/type/rpmkey.rb
View file @
e9ed59f6
...
...
@@ -23,4 +23,8 @@ Puppet::Type.newtype(:rpmkey) do
desc
"The source of the public key if the key is not already imported."
end
autorequire
(
:file
)
do
self
[
:source
]
if
self
[
:source
]
=~
/^\//
end
end
spec/unit/type/rpmkey_spec.rb
View file @
e9ed59f6
...
...
@@ -71,5 +71,23 @@ describe Puppet::Type.type(:rpmkey) do
end
end
describe
"autorequire"
do
let
(
:catalog
){
catalog
=
Puppet
::
Resource
::
Catalog
.
new
}
it
"should autorequire a local file"
do
file
=
Puppet
::
Type
.
type
(
:file
).
new
(
:name
=>
'/tmp/foo'
,
:content
=>
'bar'
)
catalog
.
add_resource
file
key
=
described_class
.
new
(
:name
=>
'DB42A60E'
,
:source
=>
'/tmp/foo'
,
:ensure
=>
:present
)
catalog
.
add_resource
key
expect
(
key
.
autorequire
.
size
).
to
eq
(
1
)
end
it
"should not fail on an absent source"
do
key
=
described_class
.
new
(
:name
=>
'DB42A60E'
,
:ensure
=>
:absent
)
expect
{
catalog
.
add_resource
key
}.
to_not
raise_error
expect
(
key
.
autorequire
.
size
).
to
eq
(
0
)
end
end
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment