forked from evolvingweb/puppet-apt
-
Notifications
You must be signed in to change notification settings - Fork 469
Add support for modern keyrings #1128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
6cef41f
Add apt::keyring defined type which creates modern-style keyrings
jorhett 2fb1b17
Update README.md
Ramesh7 bfc2c7f
Update README.md
Ramesh7 5c122e3
Update README.md
Ramesh7 e8e98e1
Update README.md
Ramesh7 d7155fb
Update README.md
Ramesh7 e423dbf
Update README.md
Ramesh7 ee8d03a
Update manifests/source.pp
Ramesh7 6525552
Update manifests/source.pp
Ramesh7 19e479b
Update manifests/source.pp
Ramesh7 da06d9a
Update manifests/source.pp
Ramesh7 3c8e3cf
Update manifests/source.pp
Ramesh7 f8ddb8c
Update manifests/init.pp
Ramesh7 ca1bcce
Update manifests/keyring.pp
Ramesh7 4c17cf5
Update manifests/keyring.pp
Ramesh7 f6eee34
Update manifests/keyring.pp
Ramesh7 ff60961
Update manifests/keyring.pp
Ramesh7 73b27de
Update manifests/keyring.pp
Ramesh7 94f392c
Update manifests/source.pp
Ramesh7 9e38a7c
Update manifests/source.pp
Ramesh7 fd32f03
Regenerating REFERENCE.md file
Ramesh7 62a3ddc
Update README.md
Ramesh7 ca1d98a
Added acceptance for keyring
praj1001 35c4736
Fixing rubocops
praj1001 9f49af5
Changed implementation for variable declaration
praj1001 dedcfc2
Changed puppetlabs spec helper version
praj1001 1abcb69
Added file location just an extra check
praj1001 072b412
Deleting the file
praj1001 63883a8
removed tabs
praj1001 2ee7f97
indent fix
praj1001 6832736
fixed closing braces
praj1001 795dcb2
Added spec for comparing contents of keyring file
praj1001 faacdf0
Rubocop fixed
praj1001 9074993
Fixed import and list keys options
praj1001 ea37970
retry on error matching
praj1001 9ada844
PR comments resolution
praj1001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# @summary Manage GPG keyrings for apt repositories | ||
# | ||
# @example Download the puppetlabs apt keyring | ||
# apt::keyring { 'puppetlabs-keyring.gpg': | ||
# source => 'https://apt.puppetlabs.com/keyring.gpg', | ||
# } | ||
# @example Deploy the apt source and associated keyring file | ||
# apt::source { 'puppet8-release': | ||
# location => 'http://apt.puppetlabs.com', | ||
# repos => 'puppet8', | ||
# key => { | ||
# name => 'puppetlabs-keyring.gpg', | ||
# source => 'https://apt.puppetlabs.com/keyring.gpg' | ||
# } | ||
# } | ||
# | ||
# @param keyring_dir | ||
# Path to the directory where the keyring will be stored. | ||
# | ||
# @param keyring_filename | ||
# Optional filename for the keyring. It should also contain extension along with the filename. | ||
# | ||
# @param keyring_file | ||
# File path of the keyring. | ||
# | ||
# @param keyring_file_mode | ||
# File permissions of the keyring. | ||
# | ||
# @param source | ||
# Source of the keyring file. Mutually exclusive with 'content'. | ||
# | ||
# @param content | ||
# Content of the keyring file. Mutually exclusive with 'source'. | ||
# | ||
# @param ensure | ||
# Ensure presence or absence of the resource. | ||
# | ||
define apt::keyring ( | ||
Stdlib::Absolutepath $keyring_dir = '/etc/apt/keyrings', | ||
String[1] $keyring_filename = $name, | ||
Stdlib::Absolutepath $keyring_file = "${keyring_dir}/${keyring_filename}", | ||
Stdlib::Filemode $keyring_file_mode = '0644', | ||
Optional[Stdlib::Filesource] $source = undef, | ||
Optional[String[1]] $content = undef, | ||
Enum['present','absent'] $ensure = 'present', | ||
) { | ||
ensure_resource('file', $keyring_dir, { ensure => 'directory', mode => '0755', }) | ||
if $source and $content { | ||
fail("Parameters 'source' and 'content' are mutually exclusive") | ||
} elsif ! $source and ! $content { | ||
fail("One of 'source' or 'content' parameters are required") | ||
} | ||
|
||
case $ensure { | ||
'present': { | ||
file { $keyring_file: | ||
ensure => 'file', | ||
mode => $keyring_file_mode, | ||
Ramesh7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
owner => 'root', | ||
group => 'root', | ||
source => $source, | ||
content => $content, | ||
} | ||
} | ||
'absent': { | ||
file { $keyring_file: | ||
ensure => $ensure, | ||
} | ||
} | ||
default: { | ||
fail("Invalid 'ensure' value '${ensure}' for apt::keyring") | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.