From cbc5be91671d58eb0b1e7efb2d53dcbc68e38054 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 23 Jan 2019 15:04:55 -0500 Subject: [PATCH] Remove unused elements hiera and serverspec aren't used anymore, let's thrash it. Change-Id: I7ae66e6b5586084e757fbbc4e3080e3ec1c173fe --- elements/hiera/10-hiera-disable | 20 ----- elements/hiera/40-hiera-datafiles | 74 ------------------- elements/hiera/README.md | 65 ---------------- elements/hiera/element-deps | 4 - .../hiera/install.d/10-hiera-yaml-symlink | 6 -- elements/hiera/install.d/11-hiera-orc-install | 8 -- .../hiera/install.d/package-installs-hiera | 2 - .../os-apply-config/etc/puppet/hiera.yaml | 12 --- elements/hiera/pkg-map | 5 -- elements/serverspec/README.md | 11 --- elements/serverspec/element-deps | 2 - .../install.d/package-installs-serverspec | 1 - .../76-serverspec-source | 4 - elements/serverspec/pkg-map | 5 -- ...le-os-collect-config-5071858da0e8be7d.yaml | 0 15 files changed, 219 deletions(-) delete mode 100755 elements/hiera/10-hiera-disable delete mode 100755 elements/hiera/40-hiera-datafiles delete mode 100644 elements/hiera/README.md delete mode 100644 elements/hiera/element-deps delete mode 100755 elements/hiera/install.d/10-hiera-yaml-symlink delete mode 100755 elements/hiera/install.d/11-hiera-orc-install delete mode 100644 elements/hiera/install.d/package-installs-hiera delete mode 100644 elements/hiera/os-apply-config/etc/puppet/hiera.yaml delete mode 100644 elements/hiera/pkg-map delete mode 100644 elements/serverspec/README.md delete mode 100644 elements/serverspec/element-deps delete mode 100644 elements/serverspec/install.d/package-installs-serverspec delete mode 100755 elements/serverspec/install.d/serverspec-source-install/76-serverspec-source delete mode 100644 elements/serverspec/pkg-map rename {elements/releasenotes => releasenotes}/notes/disable-os-collect-config-5071858da0e8be7d.yaml (100%) diff --git a/elements/hiera/10-hiera-disable b/elements/hiera/10-hiera-disable deleted file mode 100755 index 1dfb22d5..00000000 --- a/elements/hiera/10-hiera-disable +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -set -eux - -# There is a new hiera hook in town. If it is writing out -# /etc/puppet/hiera.yaml then we need to disable the o-a-c -# script that writes out the old one here. We flag on the fact -# that the new version only writes out JSON (no YAML) -if [ -f /etc/puppet/hiera.yaml ] && - ! grep yaml /etc/puppet/hiera.yaml &> /dev/null; then - if [ -f /usr/libexec/os-apply-config/templates/etc/puppet/hiera.yaml ]; then - rm /usr/libexec/os-apply-config/templates/etc/puppet/hiera.yaml - fi - if [ -f /usr/libexec/os-refresh-config/configure.d/40-hiera-datafiles ]; then - rm /usr/libexec/os-refresh-config/configure.d/40-hiera-datafiles - fi - if ls /etc/puppet/hieradata/*.yaml &> /dev/null; then - rm /etc/puppet/hieradata/*.yaml - fi -fi diff --git a/elements/hiera/40-hiera-datafiles b/elements/hiera/40-hiera-datafiles deleted file mode 100755 index 9be07a92..00000000 --- a/elements/hiera/40-hiera-datafiles +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -# Configure hiera datafiles based on Heat metadata. -set -eu - -(umask 077 ; mkdir -p /etc/puppet/hieradata) - -function write_oac_data() { - local key=$1 - local filename=$2 - # Lookup data for the associated mapping (hiera.datafiles..oac_data) - local HIERA_DATA=$(os-apply-config --key $key --type raw --key-default '') - local HIERA_DATAMAP_KEYS=$(jq keys <<< $HIERA_DATA) - local COUNT=$(($(jq length <<< $HIERA_DATAMAP_KEYS) - 1)) - - for i in $(seq 0 $COUNT); do - local KEY=$(jq -r ".[$i]" <<< $HIERA_DATAMAP_KEYS) - local OAC_KEY=$(jq -r -a ".[\"$KEY\"]" <<< $HIERA_DATA) - local OAC_VALUE=$(os-apply-config --key $OAC_KEY --type raw --key-default '') - # Quote multi-line strings for YAML - if [ $(echo -ne "$OAC_VALUE" | grep -c '$') -gt 1 ]; then - echo "$KEY: '$OAC_VALUE'" >> $filename - else - echo "$KEY: $OAC_VALUE" >> $filename - fi - - done -} - -function write_mapped_data() { - local key=$1 - local filename=$2 - # Lookup data for the associated mapping (hiera.datafiles..mapped_data) - local HIERA_DATA=$(os-apply-config --key $key --type raw --key-default '') - local HIERA_DATAMAP_KEYS=$(jq keys <<< $HIERA_DATA) - local COUNT=$(($(jq length <<< $HIERA_DATAMAP_KEYS) - 1)) - - for i in $(seq 0 $COUNT); do - local KEY=$(jq -r ".[$i]" <<< $HIERA_DATAMAP_KEYS) - local TYPE=$(jq -r ".[\"$KEY\"] | type" <<< $HIERA_DATA) - local VALUE=$(jq -a ".[\"$KEY\"]" <<< $HIERA_DATA) - - # FIXME: We should pass data types unchanged from Heat metadata to - # hiera. For now we need to treat single-line strings as raw data - # because we already depend on this in tripleo-heat-templates - # (e.g. we generate strings which look like arrays and depend on - # them being processed as real arrays in hiera). - if [ "$TYPE" = "string" ]; then - local RAW_VALUE=$(jq -r -a ".[\"$KEY\"]" <<< $HIERA_DATA) - # Treat single-line strings as raw data - if [ $(echo -ne "$RAW_VALUE" | grep -c '$') -gt 1 ]; then - echo "$KEY: $VALUE" >> $filename - else - echo "$KEY: $RAW_VALUE" >> $filename - fi - else - echo "$KEY: $VALUE" >> $filename - fi - done -} - -# Loop over all the datafiles -HIERA_DATAFILES=$(os-apply-config --key hiera.datafiles --type raw --key-default '') -HIERA_DATAFILE_KEYS=$(jq keys <<< $HIERA_DATAFILES) -COUNT=$(($(jq length <<< $HIERA_DATAFILE_KEYS) - 1)) -for i in $(seq 0 $COUNT); do - KEY=$(jq -r ".[$i]" <<< $HIERA_DATAFILE_KEYS) - FILENAME="/etc/puppet/hieradata/$KEY.yaml" - # First we write out any static data - HIERA_DATA=$(os-apply-config --key hiera.datafiles.$KEY.raw_data --type raw --key-default '') - echo -e "$HIERA_DATA" > /etc/puppet/hieradata/$KEY.yaml - write_mapped_data "hiera.datafiles.${KEY}.mapped_data" $FILENAME - write_oac_data "hiera.datafiles.${KEY}.oac_data" $FILENAME -done diff --git a/elements/hiera/README.md b/elements/hiera/README.md deleted file mode 100644 index 975a4188..00000000 --- a/elements/hiera/README.md +++ /dev/null @@ -1,65 +0,0 @@ -Configure Hiera for use w/ Puppet and Heat metadata. - -Configuration -------------- - - hiera: - hierarchy: [] - - The order to load datafiles. This is configured in hiera.yaml. - - datafiles: {} - Data files is a hash of filename -> {data/mappings} to inject - into each named hiera datafile. There are three types: - - raw_data: contains static raw data to inject directly into this hiera - datafile. Can be an inline string or imported via get_file in a - Heat template. - - mapped_data: Name value pairs that will be injected into the - hiera data file. Hiera name on the left, Hiera value on the right. - - oac_data: A hash of puppet -> OAC (os-apply-config) named key value - pairs. Arbitrary os-apply-config data can be mapped to Hiera keys - using this data. Hiera name on the left. The Hiera value is generated - at os-refresh-config time via os-apply-config lookup of the value. - -Example: --------- - - HieraConfig: - type: OS::Heat::StructuredConfig - properties: - group: os-apply-config - config: - hiera: - hierarchy: - - heat_config_%{::deploy_config_name} - - controller - - common - datafiles: - controller: - raw_data: {get_file: puppet/hieradata/controller.yaml} - oac_data: - bootstrap_nodeid: bootstrap_host.bootstrap_nodeid - common: - data: {get_file: puppet/hieradata/common.yaml} - - HieraDeployment: - type: OS::Heat::StructuredDeployment - properties: - server: {get_resource: MyServer} - config: {get_resource: HieraConfig} - signal_transport: NO_SIGNAL - -In this example the 'hierarchy' config section controls the ordering of the -hiera files within hiera.yaml. The 'datafiles' config section controls the -actual hiera data files which gets injected into the node. - -NOTE: -This example makes use of a special heat\_config\_%{::deploy\_config\_name} -heira datafile which gets generated via the heat-config-puppet element when -enable\_hiera is set to True. Since this file is injected automatically -we don't specify it in 'datafiles' but we do have it listed in the 'hierarchy'. -A FACTER\_ variable is used to provide access to the ::deploy\_config\_name -variable which is automatically set via the heat-config-puppet element when -puppet apply is executed. diff --git a/elements/hiera/element-deps b/elements/hiera/element-deps deleted file mode 100644 index b5949197..00000000 --- a/elements/hiera/element-deps +++ /dev/null @@ -1,4 +0,0 @@ -os-apply-config -os-refresh-config -package-installs -puppet diff --git a/elements/hiera/install.d/10-hiera-yaml-symlink b/elements/hiera/install.d/10-hiera-yaml-symlink deleted file mode 100755 index a9bbf03a..00000000 --- a/elements/hiera/install.d/10-hiera-yaml-symlink +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -eux -set -o pipefail - -ln -f -s /etc/puppet/hiera.yaml /etc/hiera.yaml diff --git a/elements/hiera/install.d/11-hiera-orc-install b/elements/hiera/install.d/11-hiera-orc-install deleted file mode 100755 index d35bba54..00000000 --- a/elements/hiera/install.d/11-hiera-orc-install +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -eux -set -o pipefail - -mkdir -p /usr/libexec/os-refresh-config/configure.d/ -install -m 0755 -o root -g root $(dirname $0)/../10-hiera-disable /usr/libexec/os-refresh-config/configure.d/10-hiera-disable -install -m 0755 -o root -g root $(dirname $0)/../40-hiera-datafiles /usr/libexec/os-refresh-config/configure.d/40-hiera-datafiles diff --git a/elements/hiera/install.d/package-installs-hiera b/elements/hiera/install.d/package-installs-hiera deleted file mode 100644 index 52a43d71..00000000 --- a/elements/hiera/install.d/package-installs-hiera +++ /dev/null @@ -1,2 +0,0 @@ -jq -rubygem_deep_merge_package diff --git a/elements/hiera/os-apply-config/etc/puppet/hiera.yaml b/elements/hiera/os-apply-config/etc/puppet/hiera.yaml deleted file mode 100644 index 17990b01..00000000 --- a/elements/hiera/os-apply-config/etc/puppet/hiera.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -:backends: - - json - - yaml -:json: - :datadir: /etc/puppet/hieradata -:yaml: - :datadir: /etc/puppet/hieradata -:hierarchy: - {{#hiera.hierarchy}} - - {{.}} - {{/hiera.hierarchy}} diff --git a/elements/hiera/pkg-map b/elements/hiera/pkg-map deleted file mode 100644 index dad94694..00000000 --- a/elements/hiera/pkg-map +++ /dev/null @@ -1,5 +0,0 @@ -{ - "default": { - "rubygem_deep_merge_package": "rubygem-deep_merge" - } -} diff --git a/elements/serverspec/README.md b/elements/serverspec/README.md deleted file mode 100644 index 4a713af9..00000000 --- a/elements/serverspec/README.md +++ /dev/null @@ -1,11 +0,0 @@ -Install serverspec. - -Supports gem based for now. Package mode will be eventually supported later. - -To use gem: - - export DIB\_INSTALLTYPE\_serverspec=source - -Configuration -------------- -None. diff --git a/elements/serverspec/element-deps b/elements/serverspec/element-deps deleted file mode 100644 index 73015c24..00000000 --- a/elements/serverspec/element-deps +++ /dev/null @@ -1,2 +0,0 @@ -package-installs -pkg-map diff --git a/elements/serverspec/install.d/package-installs-serverspec b/elements/serverspec/install.d/package-installs-serverspec deleted file mode 100644 index 8ee91f29..00000000 --- a/elements/serverspec/install.d/package-installs-serverspec +++ /dev/null @@ -1 +0,0 @@ -rubygems_package diff --git a/elements/serverspec/install.d/serverspec-source-install/76-serverspec-source b/elements/serverspec/install.d/serverspec-source-install/76-serverspec-source deleted file mode 100755 index 99e775a5..00000000 --- a/elements/serverspec/install.d/serverspec-source-install/76-serverspec-source +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -eux - -gem install serverspec diff --git a/elements/serverspec/pkg-map b/elements/serverspec/pkg-map deleted file mode 100644 index 7766bd18..00000000 --- a/elements/serverspec/pkg-map +++ /dev/null @@ -1,5 +0,0 @@ -{ - "default": { - "rubygems_package": "rubygems" - } -} diff --git a/elements/releasenotes/notes/disable-os-collect-config-5071858da0e8be7d.yaml b/releasenotes/notes/disable-os-collect-config-5071858da0e8be7d.yaml similarity index 100% rename from elements/releasenotes/notes/disable-os-collect-config-5071858da0e8be7d.yaml rename to releasenotes/notes/disable-os-collect-config-5071858da0e8be7d.yaml