From d3e0b3fb7bd2f225564619af111d3d03707e411b Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Tue, 28 Apr 2015 17:23:36 +0530 Subject: [PATCH] update proxy site to other sites --- ee/cli/plugins/site.py | 22 ++++++++++++++++------ ee/cli/plugins/site_functions.py | 3 ++- ee/cli/templates/siteinfo.mustache | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index 946a6b50..191e9f22 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -144,6 +144,10 @@ class EESiteController(CementBaseController): ee_db_host = siteinfo.db_host if sitetype != "html": hhvm = ("enabled" if siteinfo.is_hhvm else "disabled") + if sitetype == "proxy": + access_log = "/var/log/nginx/{0}.access.log".format(ee_domain) + error_log = "/var/log/nginx/{0}.error.log".format(ee_domain) + ee_site_webroot = '' pagespeed = ("enabled" if siteinfo.is_pagespeed else "disabled") @@ -730,14 +734,21 @@ class EESiteUpdateController(CementBaseController): Log.info(self, "Password Unchanged.") return 0 + if ((stype == "proxy" and stype == oldsitetype and self.app.pargs.hhvm) + or (stype == "proxy" and + stype == oldsitetype and self.app.pargs.pagespeed)): + Log.info(self, Log.FAIL + + "Can not update proxy site to HHVM or Pagespeed") + return 1 if stype == "html" and stype == oldsitetype and self.app.pargs.hhvm: Log.info(self, Log.FAIL + "Can not update HTML site to HHVM") return 1 - if ((stype == 'php' and oldsitetype != 'html') or - (stype == 'mysql' and oldsitetype not in ['html', 'php']) or + if ((stype == 'php' and oldsitetype not in ['html', 'proxy']) or + (stype == 'mysql' and oldsitetype not in ['html', 'php', + 'proxy']) or (stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql', - 'wp']) or + 'proxy', 'wp']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or (stype == oldsitetype and cache == oldcachetype) and @@ -781,8 +792,7 @@ class EESiteUpdateController(CementBaseController): stype = oldsitetype cache = oldcachetype - - if oldsitetype == 'html': + if oldsitetype == 'html' or oldsitetype == 'proxy': data['static'] = True data['wp'] = False data['multisite'] = False @@ -962,7 +972,7 @@ class EESiteUpdateController(CementBaseController): return 1 # Setup WordPress if old sites are html/php/mysql sites - if data['wp'] and oldsitetype in ['html', 'php', 'mysql']: + if data['wp'] and oldsitetype in ['html', 'proxy', 'php', 'mysql']: try: ee_wp_creds = setupwordpress(self, data) except SiteError as e: diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index 293b7d82..f46ee70b 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -555,7 +555,8 @@ def site_package_check(self, stype): packages = [] stack = EEStackController() stack.app = self.app - if stype in ['html', 'php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir', + 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for Nginx") if EEVariables.ee_platform_distro == 'debian': diff --git a/ee/cli/templates/siteinfo.mustache b/ee/cli/templates/siteinfo.mustache index 0381a3f0..7875709d 100644 --- a/ee/cli/templates/siteinfo.mustache +++ b/ee/cli/templates/siteinfo.mustache @@ -5,7 +5,7 @@ Nginx configuration {{type}} {{enable}} {{#hhvm}}HHVM {{hhvm}}{{/hhvm}} access_log {{accesslog}} error_log {{errorlog}} -Webroot {{webroot}} +{{#webroot}}Webroot {{webroot}}{{/webroot}} {{#dbname}}DB_NAME {{dbname}}{{/dbname}} {{#dbname}}DB_USER {{dbuser}}{{/dbname}} {{#dbname}}DB_PASS {{dbpass}}{{/dbname}}