Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
92 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
rm moreglobals.py* | ||
./install-webfaction-cpanel.py && eval $(./makeenv.py ) && ./getsource.sh && ./modifysettings.py && ./configurebackup.pl && ./modifycron.py && ./createdb.sh | ||
./install-webfaction-cpanel.py && install-webfaction-cpanel-awstats.py && eval $(./makeenv.py ) && ./configureawstats.sh && ./getsource.sh && ./modifysettings.py && ./configurebackup.pl && ./modifycron.py && ./createdb.sh | ||
./modifyhttpdconf.py && ./modifywsgi.py && ./startapache.sh | ||
chmod go-rwx globals.py* moreglobals.py* && cp globals.py moreglobals.py $OSQA_WEBAPPDIR ; chmod go-rwx $OSQA_WEBAPPDIR/globals.py $OSQA_WEBAPPDIR/moreglobals.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
AWDIR="$HOME/webapps/$OSQA_AWSTATS_APPNAME" | ||
CONFFILE="$AWDIR/cgi-bin/awstats.conf" | ||
perl -i -pe 's/DNSLookup=2/DNSLookup=1/g;' $CONFFILE; | ||
perl -i -pe 's/#LoadPlugin="hashfiles"/LoadPlugin="hashfiles"/g;' $CONFFILE; | ||
perl -i -pe "s/SiteDomain=.*/SiteDomain=\"$OSQA_FULLDOMAINNAME\"/g;" $CONFFILE; | ||
perl -i -pe 's/SkipFiles=.*/SkipFiles="REGEX[^\\\/awstats]"/g;' $CONFFILE; | ||
|
||
cd $AWDIR ; | ||
perl -i -pe 's/\.1/.*/g;' ./update_awstats.sh | ||
./update_awstats.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
WebFaction cpanel helper functions. | ||
""" | ||
|
||
import sys | ||
|
||
def try_remove(server, session_id, name, type, delete_thing, list_thing, namename="name", delete_extra_params=[]): | ||
""" | ||
Try to remove something using the webfaction API, if it exists. | ||
""" | ||
# See if the something already exists. | ||
r = server.__getattr__(list_thing)(session_id) | ||
to_delete = False | ||
for i in r: | ||
# print >> sys.stderr, i | ||
if i[namename] == name: | ||
to_delete = True | ||
break | ||
|
||
# If the something already exists, remove it before adding it | ||
if to_delete: | ||
print >> sys.stderr, "%s %s already exists. Removing..." % (type, name) | ||
# print >> sys.stderr, delete_thing, ([session_id, name] + delete_extra_params) | ||
r = server.__getattr__(delete_thing)(*([session_id, name] + delete_extra_params)) | ||
print >> sys.stderr, "server.%s: %s" % (delete_thing, r) | ||
|
||
def force_create(server, session_id, name, type, create_thing, delete_thing, list_thing, create_parameters=[], namename="name", delete_extra_params=[], overwrite=True): | ||
""" | ||
Force the creation of something using the webfaction API. | ||
overwrite determines whether to delete the entity if it exists. | ||
""" | ||
print >> sys.stderr, tuple([repr(s) for s in [server, session_id, name, type, create_thing, delete_thing, list_thing, create_parameters]]) | ||
print >> sys.stderr, "force_create(server=%s, session_id=%s, name=%s, type=%s, create_thing=%s, delete_thing=%s, list_thing=%s, create_parameters=%s)" % tuple([repr(s) for s in [server, session_id, name, type, create_thing, delete_thing, list_thing, create_parameters]]) | ||
|
||
if overwrite: | ||
try_remove(server, session_id, name, type, delete_thing, list_thing, namename=namename, delete_extra_params=delete_extra_params) | ||
|
||
# Create the something | ||
#print [session_id, name] + create_parameters | ||
r = server.__getattr__(create_thing)(*([session_id, name] + create_parameters)) | ||
print >> sys.stderr, "server.%s: %s" % (create_thing, r) | ||
return r | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python | ||
|
||
from globals import * | ||
from moreglobals import * | ||
import sys | ||
|
||
from cpanel import try_remove, force_create | ||
|
||
import xmlrpclib | ||
server = xmlrpclib.ServerProxy('https://api.webfaction.com/') | ||
session_id, account = server.login(USERNAME, PASSWORD) | ||
#print >> sys.stderr, repr(session_id) | ||
#print >> sys.stderr, repr(account) | ||
#{'username': 'test5', 'home': '/home2', 'id': 237} | ||
|
||
#for i in server.list_emails(session_id): | ||
# print >> sys.stderr, i | ||
|
||
r = force_create(server, session_id, AWSTATS_APPNAME, "app", "create_app", "delete_app", "list_apps", ['awstats68', False, WEBSITENAME]) | ||
|
||
if SERVERIP is None: | ||
SERVERIP = server.list_websites(session_id)[0]["ip"] | ||
print >> sys.stderr, "No SERVERIP given. Using %s" % SERVERIP | ||
r = force_create(server, session_id, WEBSITENAME, "website", "create_website", "delete_website", "list_websites", [SERVERIP, False, [FULLDOMAINNAME], [APPNAME, URLPATH], [AWSTATS_APPNAME, AWSTATS_URLPATH]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters