Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/base/manifests/init.pp

Issue 29338046: Issue 3638 - Introduce type adblockplus::host (Closed)
Patch Set: Created March 9, 2016, 11:57 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « modules/adblockplus/manifests/init.pp ('k') | modules/private-stub/hiera/hosts.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/base/manifests/init.pp
diff --git a/modules/base/manifests/init.pp b/modules/base/manifests/init.pp
index e18c9848e63ab1284b23ea62e8093d82775a6e55..295cc20209c6e0885814a6fbd1ebc1a786c01352 100644
--- a/modules/base/manifests/init.pp
+++ b/modules/base/manifests/init.pp
@@ -41,45 +41,34 @@ class base ($zone='adblockplus.org') {
$groups = undef,
) {
- if is_array($ip) {
- $internal_ip = $ip[0]
- } else {
- $internal_ip = $ip
+ $fqdn = $dns ? {
+ undef => "$name.${base::zone}",
+ default => $dns,
}
- $fqdn_name = join([$name, $base::zone], '.')
-
- host{$name:
- ensure => present,
- ip => $internal_ip,
- name => $fqdn_name,
- host_aliases => $dns ? {
- undef => [],
- default => $dns,
- }
+ $ips = is_array($ip) ? {
+ true => $ip,
+ default => [$ip],
}
- if $ssh_public_key != undef {
-
- $name_key = $dns ? {
- undef => $fqdn_name,
- default => $dns,
- }
+ $public_key = $ssh_public_key ? {
+ undef => undef,
+ default => "ssh-rsa $ssh_public_key $fqdn",
+ }
- @sshkey {$name:
- name => $name_key,
- key => $ssh_public_key,
- type => ssh-rsa,
- host_aliases => $ip,
- tag => 'base::explicit_host_record',
- }
+ adblockplus::host {$title:
+ fqdn => $fqdn,
+ groups => $groups,
+ ips => $ips,
+ name => $name,
+ role => $role,
+ public_key => $public_key,
}
- }
- # Work around https://projects.puppetlabs.com/issues/4145
- Sshkey<| |> ->
- file {'/etc/ssh/ssh_known_hosts':
- ensure => 'present',
- mode => 0644,
+ # Implicit realization behavior has been introduced by accident in a
+ # previous version, hence it should be kept until class base is obsolete
+ # and the obsolete records have been removed
+ realize(Host[$title])
+ realize(Sshkey[$title])
}
}
« no previous file with comments | « modules/adblockplus/manifests/init.pp ('k') | modules/private-stub/hiera/hosts.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld