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

Side by Side Diff: modules/elasticsearch/manifests/plugin.pp

Issue 29327597: Issue 2864 - Introduce class elasticsearch (Closed)
Patch Set: Created Sept. 14, 2015, 7:26 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « modules/elasticsearch/manifests/init.pp ('k') | modules/elasticsearch/templates/config.yml.erb » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # == Type: elasticsearch::plugin
2 #
3 # Manage Elasticsearch plugin installations.
4 #
5 # === Parameters:
6 #
7 # [*ensure*]
8 # Either 'present'/'installed' or 'absent'/'purged'.
9 #
10 # [*replace*]
11 # Whether to replace an existing plugin during installation.
12 #
13 # [*url*]
14 # Where to download a plugin from during installation, if not publicly
15 # available at one of the default URLs.
16 #
17 # [*version*]
18 # An explicit version to install.
19 #
20 # === Examples:
21 #
22 # elasticsearch::plugin {'license':
23 # url => $elasticsearch_license_plugin_url,
24 # }
25 #
26 # elasticsearch::plugin {'shield':
27 # require => Elasticsearch::Plugin['license'],
28 # }
29 #
30 define elasticsearch::plugin (
31 $ensure = 'present',
32 $replace = false,
33 $url = undef,
34 $version = 'latest',
35 ) {
36
37 $plugin = "${elasticsearch::directory}/bin/plugin"
38
39 Exec {
40 cwd => $elasticsearch::directory,
41 logoutput => true,
42 notify => Service['elasticsearch'],
43 require => Package['elasticsearch'],
44 }
45
46 @exec {"elasticsearch::plugin#install-$name":
47 command => shellquote($url ? {
48 undef => [$plugin, '--install', "elasticsearch/$name/$version"],
49 default => [$plugin, '--install', $name, '--url', $url, '--verbose'],
50 }),
51 creates => "${elasticsearch::directory}/plugins/$name",
52 }
53
54 @exec {"elasticsearch::plugin#remove-$name":
55 command => shellquote($plugin, '--remove', $name),
56 onlyif => shellquote('/usr/bin/test', '-e', "plugins/$name"),
57 }
58
59 if $ensure =~ /^(absent|purged)$/ {
60 realize(Exec["elasticsearch::plugin#remove-$name"])
61 }
62 elsif $replace == true {
63 Exec <|title == "elasticsearch::plugin#remove-$name"|> ->
64 Exec <|title == "elasticsearch::plugin#install-$name"|>
65 }
66 else {
67 realize(Exec["elasticsearch::plugin#install-$name"])
68 }
69 }
OLDNEW
« no previous file with comments | « modules/elasticsearch/manifests/init.pp ('k') | modules/elasticsearch/templates/config.yml.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld