Skip to content

Commit 74de013

Browse files
davejrtscotty-c
authored andcommitted
adding in logic to make docker::registry idempodent (#40)
* adding in logic to make docker::registry idempodent * undoing hardcoding * fixing directory
1 parent 7537958 commit 74de013

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

manifests/registry.pp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
$email = undef,
3636
$local_user = 'root',
3737
$version = $docker::version,
38+
$receipt = true,
3839
) {
3940
include docker::params
4041

@@ -61,13 +62,25 @@
6162
$auth_environment = undef
6263
}
6364

65+
if $receipt {
66+
# no - with pw_hash
67+
$local_user_strip = regsubst($local_user, '-', '', 'G')
68+
69+
file { "/root/registry-auth-puppet_receipt_${server}_${local_user}":
70+
ensure => $ensure,
71+
content => pw_hash("${title}${auth_environment}${auth_cmd}${local_user}", 'SHA-512', $local_user_strip),
72+
notify => Exec["${title} auth"],
73+
}
74+
}
75+
6476
exec { "${title} auth":
6577
environment => $auth_environment,
6678
command => $auth_cmd,
6779
user => $local_user,
6880
cwd => '/root',
6981
path => ['/bin', '/usr/bin'],
7082
timeout => 0,
83+
refreshonly => $receipt,
7184
}
7285

7386
}

0 commit comments

Comments
 (0)