Puppet Function: influxdb_download_url

Defined in:
lib/puppet/parser/functions/influxdb_download_url.rb
Function type:
Ruby 3.x API

Overview

influxdb_download_url()Any

Retrieves the latest or specific version from the Amazon S3 bucket that the InfluxDB team deploys packages to

Relies on puppet built-in function versioncmp for version comparison

Prototype:

$url = influxdb_download_url(a, b, c)

Where a is a boolean indicating that release candidates can be used
Where b is a boolean indicating that nightly builds can be used
Where c is version or ensure value like 'present' or 'latest'

Returns:

  • (Any)


85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/puppet/parser/functions/influxdb_download_url.rb', line 85

newfunction(:influxdb_download_url, :type => :rvalue, :doc => "
Retrieves the latest or specific version from the Amazon S3 bucket that the InfluxDB
team deploys packages to

Relies on puppet built-in function versioncmp for version comparison

Prototype:

  $url = influxdb_download_url(a, b, c)

  Where a is a boolean indicating that release candidates can be used
  Where b is a boolean indicating that nightly builds can be used
  Where c is version or ensure value like 'present' or 'latest'

") do |args|
  include_rc = args[0]
  include_nightly = args[1]
  version = args[2]
  raise Puppet::ParseError, "do not set boolean options to true if pinning specific version" if version !~ /^[a-zA-Z]+$/ and (include_rc or include_nightly)
  xml_data = get_s3_dirlist("https://s3.amazonaws.com/influxdb/")
  all_packages = get_package_files(xml_data)
  package = get_single_package(all_packages, include_rc, include_nightly, version)
  raise Puppet::ParseError, "could not find any package matching criteria" if package == nil
  "https://s3.amazonaws.com/influxdb/#{package}"
end