Gnocchi 4.2 release

Uses oslo-templates from queens release

Change-Id: Ifb924ae0c1ae3485bf4d44d09f85039a7553762f
Related-Prod: https://mirantis.jira.com/browse/PROD-20388
diff --git a/.travis.yml b/.travis.yml
index 1fb0122..a13b402 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,6 +25,14 @@
   - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2017.7 GNOCCHI_VERSION=4.0 GNOCCHI_STORAGE=redis OS_VERSION=pike SUITE=server_cluster
   - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2017.7 GNOCCHI_VERSION=4.0 GNOCCHI_STORAGE=file OS_VERSION=pike SUITE=server_single
   - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2017.7 GNOCCHI_VERSION=4.0 GNOCCHI_STORAGE=redis OS_VERSION=pike SUITE=server_single
+  #- PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2016.3 GNOCCHI_VERSION=4.2 GNOCCHI_STORAGE=file OS_VERSION=queens SUITE=server_cluster
+  #- PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2016.3 GNOCCHI_VERSION=4.2 GNOCCHI_STORAGE=redis OS_VERSION=queens SUITE=server_cluster
+  #- PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2016.3 GNOCCHI_VERSION=4.2 GNOCCHI_STORAGE=file OS_VERSION=queens SUITE=server_single
+  #- PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2016.3 GNOCCHI_VERSION=4.2 GNOCCHI_STORAGE=redis OS_VERSION=queens SUITE=server_single
+  #- PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2017.7 GNOCCHI_VERSION=4.2 GNOCCHI_STORAGE=file OS_VERSION=queens SUITE=server_cluster
+  #- PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2017.7 GNOCCHI_VERSION=4.2 GNOCCHI_STORAGE=redis OS_VERSION=queens SUITE=server_cluster
+  #- PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2017.7 GNOCCHI_VERSION=4.2 GNOCCHI_STORAGE=file OS_VERSION=queens SUITE=server_single
+  #- PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2017.7 GNOCCHI_VERSION=4.2 GNOCCHI_STORAGE=redis OS_VERSION=queens SUITE=server_single
 
 before_script:
   - set -o pipefail
diff --git a/gnocchi/files/4.2/gnocchi.conf b/gnocchi/files/4.2/gnocchi.conf
new file mode 100644
index 0000000..a26bb6e
--- /dev/null
+++ b/gnocchi/files/4.2/gnocchi.conf
@@ -0,0 +1,239 @@
+{% from "gnocchi/map.jinja" import cfg,server,statsd with context %}
+{% set storage = cfg.get('storage', {}) %}
+[DEFAULT]
+
+#
+# From cotyledon
+#
+
+# Enables or disables logging values of all registered options when starting a
+# service (at DEBUG level). (boolean value)
+# Note: This option can be changed without restarting.
+#log_options = true
+
+# Specify a timeout after which a gracefully shutdown server will exit. Zero
+# value means endless wait. (integer value)
+# Note: This option can be changed without restarting.
+#graceful_shutdown_timeout = 60
+
+#
+# From gnocchi
+#
+
+# If set to true, the logging level will be set to DEBUG. (boolean value)
+#debug = false
+debug = {{ cfg.debug }}
+
+# If set to true, the logging level will be set to INFO. (boolean value)
+#verbose = true
+
+# Base directory for log files. If not set, logging will go to stderr. (string
+# value)
+#log_dir = <None>
+
+# (Optional) Name of log file to send logging output to. If no default is set,
+# logging will go to stderr as defined by use_stderr. (string value)
+#log_file = <None>
+
+# Coordination driver URL (string value)
+#coordination_url = <None>
+{%- if cfg.coordination_backend is defined %}
+coordination_url = {{ cfg.coordination_backend.url }}
+{%- endif %}
+
+# Number of threads to use to parallelize some operations. Default is set to
+# the number of CPU available. (integer value)
+# Minimum value: 1
+# Deprecated group/name - [storage]/aggregation_workers_number
+#parallel_operations = <None>
+{%- if storage.aggregation_workers is defined %}
+parallel_operations = {{ storage.aggregation_workers }}
+{%- elif cfg.parallel_operations is defined %}
+parallel_operations = {{ cfg.parallel_operations }}
+{%- endif %}
+
+# Use syslog for logging. (boolean value)
+#use_syslog = false
+{%- if cfg.use_syslog is defined %}
+use_syslog = {{ cfg.use_syslog }}
+{%- endif %}
+
+# Enable journald for logging. If running in a systemd environment you may wish
+# to enable journal support. Doing so will use the journal native protocol
+# which includes structured metadata in addition to log messages. (boolean
+# value)
+#use_journal = false
+{%- if cfg.use_journal is defined %}
+use_journal = {{ cfg.use_journal }}
+{%- endif %}
+
+# Syslog facility to receive log lines. (string value)
+#syslog_log_facility = user
+{%- if cfg.syslog_log_facility is defined %}
+syslog_log_facility = {{ cfg.syslog_log_facility }}
+{%- endif %}
+
+[api]
+
+#
+# From gnocchi
+#
+
+# Path to API Paste configuration. (string value)
+#paste_config = api-paste.ini
+
+# Authentication mode to use. (string value)
+# Possible values:
+# remoteuser - <No description provided>
+# keystone - <No description provided>
+# basic - <No description provided>
+#auth_mode = basic
+auth_mode = {{ server.identity.engine }}
+
+# The maximum number of items returned in a single response from a collection
+# resource (integer value)
+#max_limit = 1000
+{%- if server.get('api', {}).max_limit is defined %}
+max_limit = {{ server.api.max_limit }}
+{%- endif %}
+
+# Number of seconds before timeout when attempting to do some operations.
+# (integer value)
+# Minimum value: 0
+# Deprecated group/name - [api]/refresh_timeout
+#operation_timeout = 10
+{%- if server.get('api', {}).refresh_timeout is defined %}
+operation_timeout = {{ server.api.refresh_timeout }}
+{%- elif server.api.operation_timeout is defined %}
+operation_timeout = {{ server.api.operation_timeout }}
+{%- endif %}
+
+# Host to listen on (host address value)
+#host = 0.0.0.0
+
+# Port to listen on (port value)
+# Minimum value: 0
+# Maximum value: 65535
+#port = 8041
+
+# Socket type to use for uWSGI:
+# * http: support HTTP/1.1 and keepalive,
+#   but not chunked encoding (InfluxDB)
+# * http-socket/socket: support chunked encoding, but require a upstream HTTP
+#   Server for HTTP/1.1, keepalive and HTTP protocol correctness.
+#  (string value)
+# Possible values:
+# http - <No description provided>
+# http-socket - <No description provided>
+# socket - <No description provided>
+#uwsgi_mode = http
+
+[archive_policy]
+
+#
+# From gnocchi
+#
+
+# Default aggregation methods to use in created archive policies (list value)
+#default_aggregation_methods = mean,min,max,sum,std,count
+{%- if server.get('archive_policy', {}).default_aggregation_methods is defined %}
+default_aggregation_methods = {{ ','.join(server.archive_policy.default_aggregation_methods) }}
+{%- endif %}
+
+[cors]
+
+{%- if server.cors is defined %}
+{%- set _data = server.cors %}
+{%- include "oslo_templates/files/queens/oslo/_cors.conf" %}
+{%- endif %}
+
+[incoming]
+
+{%- set _storage = storage.get('incoming', {}) %}
+{%- if _storage.driver is defined %}
+driver = {{ _storage.driver }}
+{% include "gnocchi/files/" + cfg.version|string + "/storage/_" + _storage.driver + ".conf" %}
+{%- endif %}
+
+[indexer]
+
+#
+# From gnocchi
+#
+
+# Indexer driver to use (string value)
+#url = <None>
+url = {{ cfg.database.engine }}+pymysql://{{ cfg.database.user }}:{{ cfg.database.password }}@{{ cfg.database.host }}/{{ cfg.database.name }}{%- if cfg.database.get('ssl',{}).get('enabled',False) %}?ssl_ca={{ cfg.database.ssl.get('cacert_file', cfg.cacert_file) }}{% endif %}
+
+
+{%- if server.identity.engine == 'keystone' %}
+[keystone_authtoken]
+
+{%- set _data = server.identity %}
+{%- set auth_type = _data.get('auth_type', 'password') %}
+{%- include "oslo_templates/files/queens/keystonemiddleware/_auth_token.conf" %}
+{%- include "oslo_templates/files/queens/keystoneauth/_type_" + auth_type + ".conf" %}
+{%- endif %}
+
+[oslo_middleware]
+{%- set _data = server %}
+{%- include "oslo_templates/files/queens/oslo/_middleware.conf" %}
+
+[oslo_policy]
+{%- if server.policy is defined %}
+{%- set _data = server.policy %}
+{%- include "oslo_templates/files/queens/oslo/_policy.conf" %}
+{%- endif %}
+
+[statsd]
+
+#
+# From gnocchi
+#
+
+# The listen IP for statsd (host address value)
+#host = 0.0.0.0
+{%- if statsd.get('bind', {}).address is defined %}
+host = {{ statsd.bind.address }}
+{%- endif %}
+
+# The port for statsd (port value)
+# Minimum value: 0
+# Maximum value: 65535
+#port = 8125
+{%- if statsd.get('bind', {}).port is defined %}
+port = {{ statsd.bind.port }}
+{%- endif %}
+
+# Resource UUID to use to identify statsd in Gnocchi (unknown value)
+#resource_id = <None>
+{%- if statsd.get('enabled', False) %}
+resource_id = {{ statsd.resource_id }}
+{%- endif %}
+
+# Creator value to use to identify statsd in Gnocchi (string value)
+#creator = <None>
+{%- if statsd.user_id is defined and statsd.project_id is defined %}
+creator = {{ statsd.user_id }}:{{ statsd.project_id }}
+{%- endif %}
+
+# Archive policy name to use when creating metrics (string value)
+#archive_policy_name = <None>
+{%- if statsd.archive_policy_name is defined %}
+archive_policy_name = {{ statsd.archive_policy_name }}
+{%- endif %}
+
+# Delay between flushes (floating point value)
+#flush_delay = 10
+{%- if statsd.flush_delay is defined %}
+flush_delay = {{ statsd.flush_delay }}
+{%- endif %}
+
+
+[storage]
+
+{%- set _storage = storage %}
+{%- if _storage.driver is defined %}
+driver = {{ _storage.driver }}
+{% include "gnocchi/files/" + cfg.version|string + "/storage/_" + _storage.driver + ".conf" %}
+{%- endif %}
\ No newline at end of file
diff --git a/gnocchi/files/4.2/storage/_ceph.conf b/gnocchi/files/4.2/storage/_ceph.conf
new file mode 100644
index 0000000..aad3b43
--- /dev/null
+++ b/gnocchi/files/4.2/storage/_ceph.conf
@@ -0,0 +1,23 @@
+{%- if _storage.ceph_pool is defined %}
+ceph_pool = {{ _storage.ceph_pool }}
+{%- endif %}
+
+{%- if _storage.ceph_username is defined %}
+ceph_username = {{ _storage.ceph_username }}
+{%- endif %}
+
+{%- if _storage.ceph_secret is defined %}
+ceph_secret = {{ _storage.ceph_secret }}
+{%- endif %}
+
+{%- if _storage.ceph_keyring is defined %}
+ceph_keyring = {{ _storage.ceph_keyring }}
+{%- endif %}
+
+{%- if _storage.ceph_timeout is defined %}
+ceph_timeout = {{ _storage.ceph_timeout }}
+{%- endif %}
+
+{%- if _storage.ceph_conf is defined %}
+ceph_conffile = {{ _storage.ceph_conf }}
+{%- endif %}
diff --git a/gnocchi/files/4.2/storage/_file.conf b/gnocchi/files/4.2/storage/_file.conf
new file mode 100644
index 0000000..a3d4de7
--- /dev/null
+++ b/gnocchi/files/4.2/storage/_file.conf
@@ -0,0 +1,3 @@
+{%- if _storage.file_basepath is defined %}
+file_basepath = {{ _storage.file_basepath }}
+{%- endif %}
\ No newline at end of file
diff --git a/gnocchi/files/4.2/storage/_redis.conf b/gnocchi/files/4.2/storage/_redis.conf
new file mode 100644
index 0000000..bede88b
--- /dev/null
+++ b/gnocchi/files/4.2/storage/_redis.conf
@@ -0,0 +1,3 @@
+{%- if _storage.redis_url is defined %}
+redis_url = {{ _storage.redis_url }}
+{%- endif %}
\ No newline at end of file
diff --git a/gnocchi/files/4.2/storage/_s3.conf b/gnocchi/files/4.2/storage/_s3.conf
new file mode 100644
index 0000000..b259cee
--- /dev/null
+++ b/gnocchi/files/4.2/storage/_s3.conf
@@ -0,0 +1,23 @@
+{%- if _storage.s3_endpoint_url is defined %}
+s3_endpoint_url = {{ _storage.s3_endpoint_url }}
+{%- endif %}
+
+{%- if _storage.s3_region_name is defined %}
+s3_region_name = {{ _storage.s3_region_name }}
+{%- endif %}
+
+{%- if _storage.s3_access_key_id is defined %}
+s3_access_key_id = {{ _storage.s3_access_key_id }}
+{%- endif %}
+
+{%- if _storage.s3_secret_access_key is defined %}
+s3_secret_access_key = {{ _storage.s3_secret_access_key }}
+{%- endif %}
+
+{%- if _storage.s3_bucket_prefix is defined %}
+s3_bucket_prefix = {{ _storage.s3_bucket_prefix }}
+{%- endif %}
+
+{%- if _storage.s3_check_consistency_timeout is defined %}
+s3_check_consistency_timeout = {{ _storage.s3_check_consistency_timeout }}
+{%- endif %}
\ No newline at end of file
diff --git a/gnocchi/files/4.2/storage/_swift.conf b/gnocchi/files/4.2/storage/_swift.conf
new file mode 100644
index 0000000..92d04dc
--- /dev/null
+++ b/gnocchi/files/4.2/storage/_swift.conf
@@ -0,0 +1,47 @@
+{%- if _storage.swift_auth_version %}
+swift_auth_version = {{ _storage.swift_auth_version }}
+{%- endif %}
+
+{%- if _storage.swift_preauthurl is defined %}
+swift_preauthurl = {{ _storage.swift_preauthurl }}
+{%- endif %}
+
+{%- if _storage.swift_authurl is defined %}
+swift_authurl = {{ _storage.swift_authurl }}
+{%- endif %}
+
+{%- if _storage.swift_preauthtoken is defined %}
+swift_preauthtoken = {{ _storage.swift_preauthtoken }}
+{%- endif %}
+
+{%- if _storage.swift_user is defined %}
+swift_user = {{ _storage.swift_user }}
+{%- endif %}
+
+{%- if _storage.swift_user_domain_name is defined %}
+swift_user_domain_name = {{ _storage.swift_user_domain_name }}
+{%- endif %}
+
+{%- if _storage.swift_key is defined %}
+swift_key = {{ _storage.swift_key }}
+{%- endif %}
+
+{%- if _storage.swift_project_name is defined %}
+swift_project_name = {{ _storage.swift_project_name }}
+{%- endif %}
+
+{%- if _storage.swift_project_domain_name is defined %}
+swift_project_domain_name = {{ _storage.swift_project_domain_name }}
+{%- endif %}
+
+{%- if _storage.swift_container_prefix is defined %}
+swift_container_prefix = {{ _storage.swift_container_prefix }}
+{%- endif %}
+
+{%- if _storage.swift_endpoint_type is defined %}
+swift_endpoint_type = {{ _storage.swift_endpoint_type }}
+{%- endif %}
+
+{%- if _storage.swift_timeout is defined %}
+swift_timeout = {{ _storage.swift_timeout }}
+{%- endif %}
\ No newline at end of file