Faidon Liambotis has uploaded a new change for review.
https://gerrit.wikimedia.org/r/181395
Change subject: Revert "Fix the projectgid fact"
......................................................................
Revert "Fix the projectgid fact"
In production, the greps are producting noise, but more importantly, the
fetch takes a long time to run before it times out.
This needs to be more well thought-out for prod.
This reverts commit 72c13644804d19911dc4b8c1fe056277532dcfb6.
Change-Id: I623bac06554790bd240239d07e92246a3fbc189e
---
M modules/base/lib/facter/projectgid.rb
1 file changed, 4 insertions(+), 13 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/95/181395/1
diff --git a/modules/base/lib/facter/projectgid.rb
b/modules/base/lib/facter/projectgid.rb
index b83ad10..b76d06c 100644
--- a/modules/base/lib/facter/projectgid.rb
+++ b/modules/base/lib/facter/projectgid.rb
@@ -1,26 +1,17 @@
# projectgid.rb
#
# This fact provides project_gid (gidNumber) for projects in labs.
+# This is used to set the udp_send_channel port in ganglia's gmond.conf.
require 'facter'
Facter.add(:project_gid) do
setcode do
- # Dig deep in ldap for the project name. This code echoes that in the labs
- # firstboot.sh
- binddn=Facter::Util::Resolution.exec("grep 'binddn' /etc/ldap.conf | sed
's/.* //'")
- bindpw=Facter::Util::Resolution.exec("grep 'bindpw' /etc/ldap.conf | sed
's/.* //'")
- hostsou=Facter::Util::Resolution.exec("grep 'nss_base_hosts'
/etc/ldap.conf | sed 's/.* //'")
-
- id=Facter::Util::Resolution.exec("curl
http://169.254.169.254/1.0/meta-data/instance-id 2> /dev/null")
- domain=Facter::Util::Resolution.exec("hostname -d")
- idfqdn="#{id}.#{domain}"
- project=Facter::Util::Resolution.exec("ldapsearch -x -D #{binddn} -w
#{bindpw} -b #{hostsou} \"dc=#{idfqdn}\" puppetvar | grep 'instanceproject' |
sed 's/.*=//'")
- if not project
+ if not File.exist? '/etc/ganglia/gmond.conf'
return "none"
end
-
- gid = Facter::Util::Resolution.exec("getent group project-#{project} | cut
-d : -f 3")
+ project_name = Facter::Util::Resolution.exec("egrep -A1 '^cluster {'
/etc/ganglia/gmond.conf | awk -F '\"' '/name =/ {print $2}'").chomp
+ gid = Facter::Util::Resolution.exec("getent group project-#{project_name}
| cut -d : -f 3")
if gid
gid.chomp
else
--
To view, visit https://gerrit.wikimedia.org/r/181395
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I623bac06554790bd240239d07e92246a3fbc189e
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits