Added orchestrastatus management command

This commit is contained in:
Marc Aymerich 2016-01-11 10:57:54 +00:00
parent 4099f1a422
commit 19a0a76452
1 changed files with 5 additions and 1 deletions

View File

@ -50,7 +50,11 @@ class Command(BaseCommand):
regex = r'location\s+([^\s]+)\s+{.*uwsgi_pass unix:///var/run/uwsgi/app/%(project_name)s/socket;.*' % context regex = r'location\s+([^\s]+)\s+{.*uwsgi_pass unix:///var/run/uwsgi/app/%(project_name)s/socket;.*' % context
location = re.findall(regex, config) location = re.findall(regex, config)
if location: if location:
self.stdout.write(" * location %s" % location[0]) ip = run("ip a | grep 'inet ' | awk {'print $2'} | grep -v '^127.0.' | head -n 1 | cut -d'/' -f1").stdout.decode()
if not ip:
ip = '127.0.0.1'
location = 'http://%s%s' % (ip, location[0])
self.stdout.write(" * location %s" % location)
else: else:
self.stdout.write(" * location not found") self.stdout.write(" * location not found")
elif service == 'postgresql': elif service == 'postgresql':