From 22d73279c4d5e4f481e5c2ff1108a9f34ee531cd Mon Sep 17 00:00:00 2001 From: Jordi Prats Date: Wed, 16 Oct 2019 13:38:25 +0200 Subject: [PATCH] location fuck --- CHANGELOG.md | 4 ++++ lib/facter/eypconf_location.rb | 14 ++++++++++++++ .../{eypconf_platform.rb => eypconf_platformid.rb} | 0 metadata.json | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 lib/facter/eypconf_location.rb rename lib/facter/{eypconf_platform.rb => eypconf_platformid.rb} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37c7277..9508e7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 0.1.22 + +* added **eypconf_location** + ## 0.1.21 * added double empty line at the end of the autobanner file diff --git a/lib/facter/eypconf_location.rb b/lib/facter/eypconf_location.rb new file mode 100644 index 0000000..a2a5fab --- /dev/null +++ b/lib/facter/eypconf_location.rb @@ -0,0 +1,14 @@ +if File.exists?('/opt/eypconf/id/description.sh') then + description = Facter::Util::Resolution.exec('bash /opt/eypconf/id/description.sh').to_s +else + description = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/description ]; then cat /opt/eypconf/id/description | paste -sd,; fi\'').to_s +end + +unless description.nil? or description.empty? + Facter.add('eypconf_description') do + setcode do + description + end + end + +end diff --git a/lib/facter/eypconf_platform.rb b/lib/facter/eypconf_platformid.rb similarity index 100% rename from lib/facter/eypconf_platform.rb rename to lib/facter/eypconf_platformid.rb diff --git a/metadata.json b/metadata.json index cef2dc4..90af06a 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "eyp-eyplib", - "version": "0.1.21", + "version": "0.1.22", "author": "eyp", "summary": "Utility functions for puppet modules", "license": "Apache-2.0",