Skip to content
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

Add default keyring path for aptly mirror resource #49

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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: 6 additions & 2 deletions lib/puppet/provider/aptly_mirror/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def create
flags: {
'architectures' => [resource[:architectures]].join(','),
'with-sources' => resource[:with_sources],
'with-udebs' => resource[:with_udebs]
'with-udebs' => resource[:with_udebs],
'keyring' => resource[:keyring]
}
)

Expand All @@ -28,7 +29,10 @@ def create
gid: resource[:gid],
object: :mirror,
action: 'update',
arguments: [name]
arguments: [name],
flags: {
'keyring' => resource[:keyring]
}
)
end

Expand Down
5 changes: 5 additions & 0 deletions lib/puppet/type/aptly_mirror.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
defaultto :undef
end

newparam(:keyring) do
desc 'Set path to keyring. Default /etc/apt/trusted.gpg'
defaultto "/etc/apt/trusted.gpg"
end

newparam(:with_sources, boolean: true, parent: Puppet::Parameter::Boolean) do
desc 'Whether to mirror the source packages or not'
defaultto :false
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_x/aptly/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def self.execute(options = {})

begin
Puppet.debug("Executing: #{cmd}")
result = Puppet::Util::Execution.execute(cmd, uid: uid, gid: gid)
result = Puppet::Util::Execution.execute(cmd, uid: uid, gid: gid, failonfail: true)
rescue => e
raise Puppet::Error, e.message if exceptions
e.message
Expand Down
11 changes: 6 additions & 5 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

if ! defined(User[$aptly::user]) {
user { $aptly::user:
ensure => present,
uid => $aptly::uid,
gid => $aptly::group,
shell => '/bin/bash',
require => Group[$aptly::group],
ensure => present,
uid => $aptly::uid,
gid => $aptly::group,
shell => '/bin/bash',
managehome => true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a comma at the end of this line

Copy link
Contributor

@aerostitch aerostitch May 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding that option should be an option (the shell should have been one too). Have service accounts with a home directory is not really a best practice IMO.

require => Group[$aptly::group],
}
}

Expand Down
7 changes: 6 additions & 1 deletion manifests/mirror.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
$components = [],
$with_sources = false,
$with_udebs = false,
$keyring = '/etc/apt/trusted.gpg'
) {
validate_string( $distribution)
validate_string(
$distribution,
$keyring
)
validate_array(
$architectures,
$components
Expand All @@ -34,5 +38,6 @@
components => $components,
with_sources => $with_sources,
with_udebs => $with_udebs,
keyring => $keyring,
}
}