Class: Puppet_X::Elastic::EsVersioning
- Inherits:
-
Object
- Object
- Puppet_X::Elastic::EsVersioning
- Defined in:
- lib/puppet_x/elastic/es_versioning.rb
Constant Summary collapse
- DEFAULT_OPTS =
{ 'home' => 'ES_HOME', 'logs' => 'LOG_DIR', 'data' => 'DATA_DIR', 'work' => 'WORK_DIR', 'conf' => 'CONF_DIR' }
Class Method Summary collapse
- .opt_flag(v5_or_later) ⇒ Object
- .opt_flags(package_name, catalog, opts = DEFAULT_OPTS) ⇒ Object
- .post_5?(package_name, catalog) ⇒ Boolean
Class Method Details
.opt_flag(v5_or_later) ⇒ Object
22 23 24 |
# File 'lib/puppet_x/elastic/es_versioning.rb', line 22 def self.opt_flag(v5_or_later) v5_or_later ? 'E' : 'Des.' end |
.opt_flags(package_name, catalog, opts = DEFAULT_OPTS) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/puppet_x/elastic/es_versioning.rb', line 13 def self.opt_flags(package_name, catalog, opts=DEFAULT_OPTS) is_post_v5 = post_5? package_name, catalog opt_flag = opt_flag is_post_v5 opts.delete 'work' if is_post_v5 [opt_flag, opts.map{ |k, v| "-#{opt_flag}default.path.#{k}=${#{v}}" }.sort] end |
.post_5?(package_name, catalog) ⇒ Boolean
26 27 28 29 30 31 32 33 34 |
# File 'lib/puppet_x/elastic/es_versioning.rb', line 26 def self.post_5?(package_name, catalog) if (es_pkg = catalog.resource("Package[#{package_name}]")) es_version = es_pkg.provider.properties[:version] || es_pkg.provider.properties[:ensure] else raise Puppet::Error, "could not find `Package[#{package_name}]` resource" end Puppet::Util::Package.versioncmp(es_version, '5.0.0') >= 0 end |