guillaumebort/play-gae — Issue #41: Support to GAE Backend
Author: robertowm
Created: 2012-02-25 20:50:23+00:00
State: open

I use backend instances in my project and it is a very cool feature to improve this module. I've already implemented this, changing 'commands.py'. The solution is below.

File: commands.py

Changes:
1) Put the commands in the array COMMANDS, line 18:
COMMANDS = ["gae:deploy", "gae:package", "gae:update_indexes", "gae:vacuum_indexes", "gae:update_queues", "gae:update_dos", "gae:update_cron", "gae:cron_info", "gae:update_backend", "gae:backend_info", "gae:request_logs"]

2) Put the explanations of the new commands in the array HELP, line 19:
HELP = {
'gae:deploy': "Deploy to Google App Engine",
'gae:update_indexes': "Updating Indexes",
'gae:vacuum_indexes': "Deleting Unused Indexes",
'gae:update_queues': "Managing Task Queues",
'gae:update_dos': "Managing DoS Protection",
'gae:update_cron': "Managing Scheduled Tasks : upload cron job specifications",
'gae:cron_info': "Managing Scheduled Tasks : verify your cron configuration",
'gae:update_backend': "Managing Backend Instances : update your backend configuration",
'gae:backend_info': "Managing Backend Instances : verify your backend configuration",
'gae:request_logs': "Download logs from Google App Engine",
}

3) Insert the following code in the end of the file (inside 'def execute(**kargs)'):
if command == "gae:update_backend":
print '~'
print '~ Updating backend specifications'
print '~ ---------'

if os.name == 'nt':
os.system('%s/bin/appcfg.cmd backends update %s' % (gae_path, war_path))
else:
os.system('%s/bin/appcfg.sh backends update %s' % (gae_path, war_path))
print "~ "
print "~ Done!"
print "~ "
sys.exit(-1)
if command == "gae:backend_info":
print '~'
print '~ Listing backend specifications'
print '~ ---------'
if os.name == 'nt':
os.system('%s/bin/appcfg.cmd backends list %s' % (gae_path, war_path))
else:
os.system('%s/bin/appcfg.sh backends list %s' % (gae_path, war_path))
print "~ "
print "~ Done!"
print "~ "
sys.exit(-1)