Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 # == Type: adblockplus::web::static::hook | 1 # == Type: adblockplus::web::static::hook |
2 # | 2 # |
3 # Manage custom hooks to be triggered via ssh commands | 3 # Manage custom hooks to be triggered via ssh commands |
4 # | 4 # |
5 # === Parameters: | 5 # === Parameters: |
6 # | 6 # |
7 # [*file*] | 7 # [*file*] |
8 # Overwrite the default configuration for the hook. | 8 # Overwrite group and the source of the content of the file. |
9 # | 9 # |
10 # === Examples: | 10 # === Examples: |
11 # | 11 # |
12 # adblockplus::web::static::hook {'deploy': | 12 # adblockplus::web::static::hook {'deploy': |
13 # 'file' => { | 13 # file => { |
14 # source => 'puppet:///modules/adblockplus/web/deploy.py', | 14 # source => 'puppet:///modules/adblockplus/web/deploy.py', |
15 # path => '/usr/local/bin/deploy.py', | 15 # path => '/usr/local/bin/deploy.py', |
16 # }, | 16 # }, |
17 # 'own-uname' => { | 17 # } |
mathias
2018/03/27 14:46:51
This seems like a fragment that doesn't belong her
f.lopez
2018/03/27 19:29:50
Oh, I didn't delete the other example, I'll fix it
| |
18 # | |
19 # adblockplus::web::static::hook {'uname': | |
20 # file => { | |
18 # content => 'uname -a', | 21 # content => 'uname -a', |
19 # }, | 22 # }, |
20 # } | 23 # } |
21 # | 24 # |
25 # adblockplus::web::static::hook {'uptime': | |
26 # file => { | |
27 # target => '/usr/bin/uptime', | |
28 # ensure => 'link', | |
29 # }, | |
30 # } | |
31 # | |
22 define adblockplus::web::static::hook ( | 32 define adblockplus::web::static::hook ( |
23 $file = {}, | 33 $file, |
24 ) { | 34 ) { |
25 | 35 |
26 File { | 36 $hook_path = "/home/${adblockplus::web::static::deploy_user}/bin/${name}" |
37 | |
38 ensure_resource('file', "web-deploy-hook#${title}", merge({ | |
39 group => $adblockplus::web::static::deploy_user, | |
40 ensure => ensure_file_state($adblockplus::web::static::ensure), | |
41 }, $file, { | |
27 mode => '0755', | 42 mode => '0755', |
28 owner => $adblockplus::web::static::deploy_user, | 43 owner => $adblockplus::web::static::deploy_user, |
29 group => $adblockplus::web::static::deploy_user, | 44 path => $hook_path, |
30 } | 45 })) |
31 | |
32 ensure_resource('file', "/usr/local/bin/commands", { | |
mathias
2018/03/27 14:46:51
You shall not create a global command called "comm
f.lopez
2018/03/27 19:29:50
Acknowledged.
| |
33 ensure => ensure_file_state($adblockplus::web::static::ensure), | |
34 content => template('adblockplus/web/commands.sh.erb'), | |
35 }) | |
36 | |
37 ensure_resource('file', "/home/$adblockplus::web::static::deploy_user/bin", { | |
mathias
2018/03/27 14:46:51
As long as adblockplus::web::static is a class thi
f.lopez
2018/03/27 19:29:50
Acknowledged.
| |
38 ensure => ensure_directory_state($adblockplus::web::static::ensure), | |
39 }) | |
40 | |
41 ensure_resource('file', | |
mathias
2018/03/27 14:46:51
Now which convention was the base for the kind of
f.lopez
2018/03/27 19:29:50
The line would be 80+ if I didn't split it up, so
| |
42 "script#${name}", | |
mathias
2018/03/27 14:46:51
Using "script#" as a local context prefix for file
f.lopez
2018/03/27 19:29:50
Acknowledged.
| |
43 merge({ | |
44 ensure => ensure_file_state($adblockplus::web::static::ensure), | |
45 path => "/home/$adblockplus::web::static::deploy_user/bin/${name}", | |
46 }, $file)) | |
mathias
2018/03/27 14:46:51
The "path" should be merged after $file (maybe "en
f.lopez
2018/03/27 19:29:50
Acknowledged.
| |
47 | |
48 } | 46 } |
49 | 47 |
LEFT | RIGHT |