-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from skoef/master
Added support for managing multiple repositories
- Loading branch information
Showing
5 changed files
with
92 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,39 @@ | ||
# This configures a single PkgNG repository. Instead of defining the repo | ||
# with the repo URL, we split it up in hostname, mirror_type, protocol and | ||
# repopath. This way, this resource can be integrated with possible firewalls | ||
# better. | ||
|
||
define pkgng::repo ( | ||
$packagehost = $name, | ||
$release = $::operatingsystemrelease, | ||
$protocol = 'http', | ||
$mirror_type = 'srv', | ||
$repopath = '/${ABI}/latest', | ||
$enabled = true, | ||
) { | ||
include ::pkgng | ||
|
||
# validate protocol against chosen mirror_type | ||
case $mirror_type { | ||
/(?i:srv)/: { | ||
if $protocol !~ /(?i:http(s)?)/ { | ||
fail("Mirror type ${mirror_type} support http:// and https:// only") | ||
} | ||
} | ||
/(?i:http)/: { | ||
if $protocol !~ /(?i:(http|https|ftp|file|ssh))/ { | ||
fail("Mirror type ${mirror_type} support http://, https://, ftp://, file://, ssh:// only") | ||
} | ||
} | ||
default: { | ||
fail("Mirror type ${mirror_type} not supported") | ||
} | ||
} | ||
|
||
# define repository configuration | ||
file { "/usr/local/etc/pkg/repos/${name}.conf": | ||
ensure => $ensure, | ||
content => template("${module_name}/repo.erb"), | ||
notify => Exec['pkg update'], | ||
} | ||
} |
This file contains 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,7 @@ | ||
# File managed by Puppet | ||
|
||
<%= @name -%>: { | ||
url: "<% if @mirror_type =~ /srv/i %>pkg+<% end %><%= @protocol %>://<%= @packagehost %><%= @repopath %>", | ||
mirror_type: "<%= @mirror_type %>", | ||
enabled: <% if @enabled == true or @enabled == 'yes' %>yes<% else %>no<% end %>, | ||
} |