Fixed setupnginx command bug

This commit is contained in:
Marc Aymerich 2015-06-12 13:01:56 +00:00
parent 6ff0184dd1
commit 482de3157e
3 changed files with 7 additions and 6 deletions

View File

@ -427,6 +427,6 @@ serailzer self.instance on create.
# IF modsecurity... and Merge websites locations
# backend email error log with links to instances
# PHP backend multiple FPM directories support
# backend email error log with link to backend log on admin
# ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/home/orchestra/panel/orchestra.log'

View File

@ -8,7 +8,7 @@ from django.db import models
def create_initial_superuser(**kwargs):
if '--noinput' not in sys.argv and '--fake' not in sys.argv and '--fake-initial' not in sys.argv and 'accounts' in sys.argv:
if '--noinput' not in sys.argv and '--fake' not in sys.argv and '--fake-initial' not in sys.argv:
model = get_user_model()
if not model.objects.filter(is_superuser=True).exists():
sys.stdout.write(textwrap.dedent("""

View File

@ -220,12 +220,13 @@ class Command(BaseCommand):
'conf': uwsgi_conf
}
interactive = options.get('interactive')
for extra_context in (nginx, uwsgi):
context.update(extra_context)
diff = run("echo '%(conf)s' | diff - %(file)s" % context, valid_codes=(0,1,2))
diff = run("cat << 'EOF' | diff - %(file)s\n%(conf)s\nEOF" % context, valid_codes=(0,1,2))
if diff.exit_code == 2:
# File does not exist
run("echo '%(conf)s' > %(file)s" % context, display=True)
run("cat << 'EOF' > %(file)s\n%(conf)s\nEOF" % context, display=True)
elif diff.exit_code == 1:
# File is different, save the old one
if interactive:
@ -240,7 +241,7 @@ class Command(BaseCommand):
return
break
run("cp %(file)s %(file)s.save" % context, display=True)
run("echo '%(conf)s' > %(file)s" % context, display=True)
run("cat << 'EOF' > %(file)s\n%(conf)s\nEOF" % context, display=True)
self.stdout.write("\033[1;31mA new version of %(file)s has been installed.\n "
"The old version has been placed at %(file)s.save\033[m" % context)