Ryan Lane has uploaded a new change for review.
https://gerrit.wikimedia.org/r/58240
Change subject: Remove instance finish scripts
......................................................................
Remove instance finish scripts
I've changed how the bootstrapping works, so this hackish code
that's supposed to run in the last stages can go.
Change-Id: I7af2e018a37fa3eb5acbfc105ec2fade27187c10
---
D files/ldap/scripts/mail-instance-creator.py
M manifests/base.pp
M manifests/ldap.pp
M manifests/stages.pp
4 files changed, 0 insertions(+), 92 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/40/58240/1
diff --git a/files/ldap/scripts/mail-instance-creator.py
b/files/ldap/scripts/mail-instance-creator.py
deleted file mode 100755
index 828607f..0000000
--- a/files/ldap/scripts/mail-instance-creator.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/python
-
-#####################################################################
-### THIS FILE IS MANAGED BY PUPPET
-### puppet:///files/ldap/scripts/mail-instance-creator.py
-#####################################################################
-
-
-import urllib
-import os
-
-from xml.dom import minidom
-from optparse import OptionParser
-from socket import gethostname;
-
-def main():
- parser = OptionParser(conflict_handler="resolve")
- parser.set_usage("mail-instance-creator.py <from-email-address>
<to-email-address> <languagecode> <wikiaddress>\n\n\texample:
mail-instance-creator.py '[email protected]' 'es' 'http://example.com/w/'")
-
- (options, args) = parser.parse_args()
-
- if len(args) != 4:
- parser.error("mail-instance-creator.py expects exactly four
arguments.")
-
- fromaddress = args[0]
- toaddress = args[1]
- lang = args[2]
- wikiaddress = args[3]
- subjecturl = wikiaddress +
'api.php?action=expandtemplates&text={{msgnw:mediawiki:openstackmanager-email-subject/'
+ lang + '}}&format=xml'
- bodyurl = wikiaddress +
'api.php?action=expandtemplates&text={{msgnw:mediawiki:openstackmanager-email-body/'
+ lang + '}}&format=xml'
- dom = minidom.parse(urllib.urlopen(subjecturl))
- subject = dom.getElementsByTagName('expandtemplates')[0].firstChild.data
- dom = minidom.parse(urllib.urlopen(bodyurl))
- body = dom.getElementsByTagName('expandtemplates')[0].firstChild.data
- body = body + ' ' + gethostname()
- sendmail_location = "/usr/sbin/sendmail" # sendmail location
- p = os.popen("%s -t" % sendmail_location, "w")
- p.write("From: %s\n" % fromaddress)
- p.write("To: %s\n" % toaddress)
- p.write("Subject: %s\n" % subject)
- p.write("\n") # blank line separating headers from body
- p.write(body)
- status = p.close()
- return status
-
-if __name__ == "__main__":
- main()
diff --git a/manifests/base.pp b/manifests/base.pp
index 75feed0..1ddcb75 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -468,24 +468,6 @@
}
-class base::instance-finish {
-
- if $::realm == "labs" {
- ## The following causes a dependency cycle
- #Class["base::remote-syslog"] -> Class["base::instance-finish"]
- #file {
- # "/etc/rsyslog.d/60-puppet.conf":
- # ensure => absent,
- # notify => Service[rsyslog];
- #}
- file {
- "/etc/init/runonce-fixpuppet.conf":
- ensure => absent;
- }
- }
-
-}
-
class base::vimconfig {
file { "/etc/vim/vimrc.local":
owner => root,
diff --git a/manifests/ldap.pp b/manifests/ldap.pp
index 48fad4f..e253419 100644
--- a/manifests/ldap.pp
+++ b/manifests/ldap.pp
@@ -407,11 +407,6 @@
group => root,
mode => 0544,
source =>
"puppet:///files/ldap/scripts/ldapsupportlib.py";
- "/usr/local/sbin/mail-instance-creator.py":
- owner => root,
- group => root,
- mode => 0544,
- source =>
"puppet:///files/ldap/scripts/mail-instance-creator.py";
"/etc/ldap/scriptconfig.py":
owner => root,
group => root,
@@ -494,21 +489,6 @@
require => Package["autofs5", "autofs5-ldap", "ldap-utils",
"libnss-ldapd" ],
subscribe => File[$autofs_subscribe],
ensure => running;
- }
-}
-
-class ldap::client::instance-finish {
- # Hacks to ensure these services are reloaded after the puppet run
finishes
- if $realm == "labs" {
- exec { "check_nscd":
- command => "/etc/init.d/nscd restart",
- unless => "/usr/bin/id novaadmin";
- }
-
- exec { "check_autofs":
- command => "/etc/init.d/autofs restart",
- creates => "/home/autofs_check";
- }
}
}
@@ -599,10 +579,5 @@
}
}
- exec {
- "/usr/local/sbin/mail-instance-creator.py
[email protected] $instancecreator_email $instancecreator_lang
https://wikitech.wikimedia.org/w/ && touch /var/lib/cloud/data/.usermailed":
- require => [
File['/usr/local/sbin/mail-instance-creator.py'], File['/etc/default/exim4'],
Service['exim4'], Package['exim4-daemon-light'] ],
- creates => "/var/lib/cloud/data/.usermailed";
- }
}
}
diff --git a/manifests/stages.pp b/manifests/stages.pp
index bc4bed9..7d3cfd8 100644
--- a/manifests/stages.pp
+++ b/manifests/stages.pp
@@ -3,6 +3,4 @@
class {
"apt::update": stage => first;
- "base::instance-finish": stage => last;
- "ldap::client::instance-finish": stage => last;
}
--
To view, visit https://gerrit.wikimedia.org/r/58240
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7af2e018a37fa3eb5acbfc105ec2fade27187c10
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ryan Lane <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits