Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updating mediawiki for recent juju changes (revision, open-port, priv…

…ate-address in relation-get)
  • Loading branch information...
commit c3b4fbe457466092b15cdd7a63287066111204dc 1 parent 50d222b
@SpamapS SpamapS authored
View
4 hooks/cache-relation-changed
@@ -15,8 +15,8 @@ for memcached_unit in rl.stdout:
stdout=subprocess.PIPE, close_fds=True)
settings = json.loads(p.stdout.read().strip())
try:
- if 'host' in settings and 'port' in settings:
- memcached_ips.append("'%s:%d'" % getaddrinfo(settings['host'],int(settings['port']))[0][4][0:2])
+ if 'private-address' in settings and 'port' in settings:
+ memcached_ips.append("'%s:%d'" % getaddrinfo(settings['private-address'],int(settings['port']))[0][4][0:2])
except KeyError:
print memcached_unit + " has no settings. ["+str(settings)+"]"
View
9 hooks/cache-relation-joined
@@ -1,9 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import subprocess
-
-# Feed our hostname in
-p = subprocess.Popen("hostname",stdout=subprocess.PIPE,close_fds=True)
-subprocess.call(["relation-set","hostname="+p.stdout.read().strip()])
-p.wait()
View
17 hooks/db-relation-changed
@@ -161,16 +161,10 @@ $wgEnableProfileInfo = false;
def setup_mediawiki():
- hostname = subprocess.check_output(['hostname','-f']).strip()
remote_unit = os.environ.get("JUJU_REMOTE_UNIT")
print "remote unit", remote_unit
- # Check we haven't already been setup.
- #if os.path.exists(config_file_path_template % hostname):
- # print "Already Configured, Exiting"
- # return
-
p = subprocess.Popen(["relation-get", "--format", "json"],
stdout=subprocess.PIPE, close_fds=True)
settings = json.loads(p.stdout.read().strip())
@@ -186,18 +180,17 @@ def setup_mediawiki():
database = settings.get("database")
password = settings.get("password")
user = settings.get("user")
- host = settings.get("host")
+ private_address = settings.get("private-address")
# Generate this the same way the installer does
secret_key = open("/dev/urandom","r").read(32).encode('hex')
# Ensure the remote unit has self configured.
config = {
- "database_host": host,
+ "database_host": private_address,
"database": database,
"database_password": password,
"database_user": user,
- "hostname": hostname,
"secret_key": secret_key}
# Verify we have all of our database settings.
@@ -237,7 +230,7 @@ def setup_mediawiki():
print "index.html not present"
# Write the adminsettings
- connection = MySQLdb.connect(user=user, host=host, passwd=password, db=database)
+ connection = MySQLdb.connect(user=user, host=private_address, passwd=password, db=database)
cursor = connection.cursor()
do_install = None
try:
@@ -263,7 +256,7 @@ def setup_mediawiki():
'Enotif':'enotif_disabled',
'Eauthent':'eauthent_enabled',
'DBtype':'mysql',
- 'DBserver':host,
+ 'DBserver':private_address,
'DBname':database,
'DBuser':user,
'DBpassword':password,
@@ -299,4 +292,6 @@ def setup_mediawiki():
print "Running " + scriptpath
subprocess.check_call(scriptpath)
+ subprocess.check_call(['open-port','80'])
+
setup_mediawiki()
View
2  hooks/slave-relation-changed
@@ -34,7 +34,7 @@ foreach ($units as $node)
$node = json_decode($json);
if ($node->slave == 'True')
{
- $dbservers[] = array('host'=>$node->host,'dbname'=>$node->database,'user'=>$node->user,'password'=>$node->password,'type'=>'mysql','load'=>1,'flags'=>DBO_DEFAULT);
+ $dbservers[] = array('host'=>$node->{'private-address'},'dbname'=>$node->database,'user'=>$node->user,'password'=>$node->password,'type'=>'mysql','load'=>1,'flags'=>DBO_DEFAULT);
}
}
View
1  hooks/start
@@ -1 +0,0 @@
-#!/bin/bash
View
3  hooks/stop
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-/etc/init.d/apache2 stop
View
1  metadata.yaml
@@ -1,5 +1,4 @@
name: mediawiki
-revision: 68
summary: "website engine for collaborative work"
description: |
MediaWiki is a wiki engine (a program for creating a collaboratively
View
1  revision
@@ -0,0 +1 @@
+69
Please sign in to comment.
Something went wrong with that request. Please try again.