@expose(hide=True)
    def default(self):
        # self.app.render((data), 'default.mustache')
        # Check domain name validation
        data = dict()
        host, port = None, None
        try:
            stype, cache = detSitePar(vars(self.app.pargs))
        except RuntimeError as e:
            Log.debug(self, str(e))
            Log.error(self, "Please provide valid options to creating site")

        if stype is None and self.app.pargs.proxy:
            stype, cache = 'proxy', ''
            proxyinfo = self.app.pargs.proxy[0].strip()
            if not proxyinfo:
                Log.error(self, "Please provide proxy server host information")
            proxyinfo = proxyinfo.split(':')
            host = proxyinfo[0].strip()
            port = '80' if len(proxyinfo) < 2 else proxyinfo[1].strip()
        elif stype is None and not self.app.pargs.proxy:
            stype, cache = 'html', 'basic'
        elif stype and self.app.pargs.proxy:
            Log.error(self, "proxy should not be used with other site types")
        if (self.app.pargs.proxy and (self.app.pargs.pagespeed
           or self.app.pargs.hhvm)):
            Log.error(self, "Proxy site can not run on pagespeed or hhvm")

        if not self.app.pargs.site_name:
            try:
                while not self.app.pargs.site_name:
                    # preprocessing before finalize site name
                    self.app.pargs.site_name = (input('Enter site name : ')
                                                .strip())
            except IOError as e:
                Log.debug(self, str(e))
                Log.error(self, "Unable to input site name, Please try again!")

        self.app.pargs.site_name = self.app.pargs.site_name.strip()
        (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)

        if not ee_domain.strip():
            Log.error("Invalid domain name, "
                      "Provide valid domain name")

        ee_site_webroot = EEVariables.ee_webroot + ee_domain

        if check_domain_exists(self, ee_domain):
            Log.error(self, "site {0} already exists".format(ee_domain))
        elif os.path.isfile('/etc/nginx/sites-available/{0}'
                            .format(ee_domain)):
            Log.error(self, "Nginx configuration /etc/nginx/sites-available/"
                      "{0} already exists".format(ee_domain))

        if stype == 'proxy':
            data['site_name'] = ee_domain
            data['www_domain'] = ee_www_domain
            data['proxy'] = True
            data['host'] = host
            data['port'] = port
            ee_site_webroot = ""

        if self.app.pargs.php7:
            data = dict(site_name=ee_domain, www_domain=ee_www_domain,
                        static=False,  basic=False, php7=True, wp=False, w3tc=False,
                        wpfc=False, wpsc=False, multisite=False,
                        wpsubdir=False, webroot=ee_site_webroot)
            data['basic'] = True

        if stype in ['html', 'php' ]:
            data = dict(site_name=ee_domain, www_domain=ee_www_domain,
                        static=True,  basic=False, php7=False, wp=False, w3tc=False,
                        wpfc=False, wpsc=False, multisite=False,
                        wpsubdir=False, webroot=ee_site_webroot)

            if stype == 'php':
                data['static'] = False
                data['basic'] = True

        elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:

            data = dict(site_name=ee_domain, www_domain=ee_www_domain,
                        static=False,  basic=True, wp=False, w3tc=False,
                        wpfc=False, wpsc=False, wpredis=False, multisite=False,
                        wpsubdir=False, webroot=ee_site_webroot,
                        ee_db_name='', ee_db_user='', ee_db_pass='',
                        ee_db_host='')

            if stype in ['wp', 'wpsubdir', 'wpsubdomain']:
                data['wp'] = True
                data['basic'] = False
                data[cache] = True
                data['wp-user'] = self.app.pargs.user
                data['wp-email'] = self.app.pargs.email
                data['wp-pass'] = self.app.pargs.wppass
                if stype in ['wpsubdir', 'wpsubdomain']:
                    data['multisite'] = True
                    if stype == 'wpsubdir':
                        data['wpsubdir'] = True
        else:
            pass

        if stype == "html" and self.app.pargs.hhvm:
            Log.error(self, "Can not create HTML site with HHVM")

        if data and self.app.pargs.php7:
            if (not self.app.pargs.experimental):
                Log.info(self, "PHP7.0 is experimental feature and it may not "
                         "work with all CSS/JS/Cache of your site.\nDo you wish"
                         " to install PHP 7.0 now for {0}?".format(ee_domain))

                # Check prompt
                check_prompt = input("Type \"y\" to continue [n]:")
                if check_prompt != "Y" and check_prompt != "y":
                    Log.info(self, "Not using PHP 7.0 for site.")
                    data['php7'] = False
                    data['basic'] = True
                    php7 = 0
                    self.app.pargs.php7 = False
                else:
                    data['php7'] = True
                    php7 = 1
            else:
                data['php7'] = True
                php7 = 1
        elif data:
            data['php7'] = False
            php7 = 0

        if (not self.app.pargs.w3tc) and\
            (not self.app.pargs.wpfc) and (not self.app.pargs.wpsc) and (not self.app.pargs.wpredis) \
              and (not self.app.pargs.hhvm):
            data['basic'] = True

        #for debug purpose
        #for key, value in data.items() :
         #   print (key, value)


        if data and self.app.pargs.hhvm:
            if (not self.app.pargs.experimental):
                Log.info(self, "HHVM is experimental feature and it may not "
                         "work with all plugins of your site.\nYou can "
                         "disable it by passing --hhvm=off later.\nDo you wish"
                         " to enable HHVM now for {0}?".format(ee_domain))

                # Check prompt
                check_prompt = input("Type \"y\" to continue [n]:")
                if check_prompt != "Y" and check_prompt != "y":
                    Log.info(self, "Not using HHVM for site.")
                    data['hhvm'] = False
                    hhvm = 0
                    self.app.pargs.hhvm = False
                else:
                    data['hhvm'] = True
                    hhvm = 1
            else:
                data['hhvm'] = True
                hhvm = 1

        elif data:
            data['hhvm'] = False
            hhvm = 0

        if data and self.app.pargs.pagespeed:
            if (not self.app.pargs.experimental):
                Log.info(self, "PageSpeed is experimental feature and it may not "
                         "work with all CSS/JS/Cache of your site.\nYou can "
                         "disable it by passing --pagespeed=off later.\nDo you wish"
                         " to enable PageSpeed now for {0}?".format(ee_domain))

                # Check prompt
                check_prompt = input("Type \"y\" to continue [n]:")
                if check_prompt != "Y" and check_prompt != "y":
                    Log.info(self, "Not using PageSpeed for site.")
                    data['pagespeed'] = False
                    pagespeed = 0
                    self.app.pargs.pagespeed = False
                else:
                    data['pagespeed'] = True
                    pagespeed = 1
            else:
                data['pagespeed'] = True
                pagespeed = 1
        elif data:
            data['pagespeed'] = False
            pagespeed = 0

        if (cache == 'wpredis' and (not self.app.pargs.experimental)):
            Log.info(self, "Redis is experimental feature and it may not "
                     "work with all CSS/JS/Cache of your site.\nYou can "
                     "disable it by changing cache later.\nDo you wish"
                     " to enable Redis now for {0}?".format(ee_domain))

                # Check prompt
            check_prompt = input("Type \"y\" to continue [n]:")
            if check_prompt != "Y" and check_prompt != "y":
                Log.error(self, "Not using Redis for site")
                cache = 'basic'
                data['wpredis'] = False
                data['basic'] = True
                self.app.pargs.wpredis = False

        #     self.app.args.print_help()
        # if not data:
        #     self.app.close(1)

        # Check rerequired packages are installed or not
        ee_auth = site_package_check(self, stype)

        try:
            pre_run_checks(self)
        except SiteError as e:
            Log.debug(self, str(e))
            Log.error(self, "NGINX configuration check failed.")

        try:
            try:
                # setup NGINX configuration, and webroot
                setupdomain(self, data)

                # Fix Nginx Hashbucket size error
                hashbucket(self)
            except SiteError as e:
                # call cleanup actions on failure
                Log.info(self, Log.FAIL + "Oops Something went wrong !!")
                Log.info(self, Log.FAIL + "Calling cleanup actions ...")
                doCleanupAction(self, domain=ee_domain,
                                webroot=data['webroot'])
                Log.debug(self, str(e))
                Log.error(self, "Check logs for reason "
                          "`tail /var/log/ee/ee.log` & Try Again!!!")

            if 'proxy' in data.keys() and data['proxy']:
                addNewSite(self, ee_domain, stype, cache, ee_site_webroot)
                # Service Nginx Reload
                if not EEService.reload_service(self, 'nginx'):
                    Log.info(self, Log.FAIL + "Oops Something went wrong !!")
                    Log.info(self, Log.FAIL + "Calling cleanup actions ...")
                    doCleanupAction(self, domain=ee_domain)
                    deleteSiteInfo(self, ee_domain)
                    Log.error(self, "service nginx reload failed. "
                              "check issues with `nginx -t` command")
                    Log.error(self, "Check logs for reason "
                              "`tail /var/log/ee/ee.log` & Try Again!!!")
                if ee_auth and len(ee_auth):
                    for msg in ee_auth:
                        Log.info(self, Log.ENDC + msg, log=False)
                Log.info(self, "Successfully created site"
                         " http://{0}".format(ee_domain))
                return
            # Update pagespeed config
            if self.app.pargs.pagespeed:
                operateOnPagespeed(self, data)

            if data['php7']:
                php_version = "7.0"
            else:
                php_version = "5.6"


            addNewSite(self, ee_domain, stype, cache, ee_site_webroot,
                       hhvm=hhvm, pagespeed=pagespeed, php_version=php_version)

            # Setup database for MySQL site
            if 'ee_db_name' in data.keys() and not data['wp']:
                try:
                    data = setupdatabase(self, data)
                    # Add database information for site into database
                    updateSiteInfo(self, ee_domain, db_name=data['ee_db_name'],
                                   db_user=data['ee_db_user'],
                                   db_password=data['ee_db_pass'],
                                   db_host=data['ee_db_host'])
                except SiteError as e:
                    # call cleanup actions on failure
                    Log.debug(self, str(e))
                    Log.info(self, Log.FAIL + "Oops Something went wrong !!")
                    Log.info(self, Log.FAIL + "Calling cleanup actions ...")
                    doCleanupAction(self, domain=ee_domain,
                                    webroot=data['webroot'],
                                    dbname=data['ee_db_name'],
                                    dbuser=data['ee_db_user'],
                                    dbhost=data['ee_db_host'])
                    deleteSiteInfo(self, ee_domain)
                    Log.error(self, "Check logs for reason "
                              "`tail /var/log/ee/ee.log` & Try Again!!!")

                try:
                    eedbconfig = open("{0}/ee-config.php"
                                      .format(ee_site_webroot),
                                      encoding='utf-8', mode='w')
                    eedbconfig.write("<?php \ndefine('DB_NAME', '{0}');"
                                     "\ndefine('DB_USER', '{1}'); "
                                     "\ndefine('DB_PASSWORD', '{2}');"
                                     "\ndefine('DB_HOST', '{3}');\n?>"
                                     .format(data['ee_db_name'],
                                             data['ee_db_user'],
                                             data['ee_db_pass'],
                                             data['ee_db_host']))
                    eedbconfig.close()
                    stype = 'mysql'
                except IOError as e:
                    Log.debug(self, str(e))
                    Log.debug(self, "Error occured while generating "
                              "ee-config.php")
                    Log.info(self, Log.FAIL + "Oops Something went wrong !!")
                    Log.info(self, Log.FAIL + "Calling cleanup actions ...")
                    doCleanupAction(self, domain=ee_domain,
                                    webroot=data['webroot'],
                                    dbname=data['ee_db_name'],
                                    dbuser=data['ee_db_user'],
                                    dbhost=data['ee_db_host'])
                    deleteSiteInfo(self, ee_domain)
                    Log.error(self, "Check logs for reason "
                              "`tail /var/log/ee/ee.log` & Try Again!!!")

            # Setup WordPress if Wordpress site
            if data['wp']:
                try:
                    ee_wp_creds = setupwordpress(self, data)
                    # Add database information for site into database
                    updateSiteInfo(self, ee_domain, db_name=data['ee_db_name'],
                                   db_user=data['ee_db_user'],
                                   db_password=data['ee_db_pass'],
                                   db_host=data['ee_db_host'])
                except SiteError as e:
                    # call cleanup actions on failure
                    Log.debug(self, str(e))
                    Log.info(self, Log.FAIL + "Oops Something went wrong !!")
                    Log.info(self, Log.FAIL + "Calling cleanup actions ...")
                    doCleanupAction(self, domain=ee_domain,
                                    webroot=data['webroot'],
                                    dbname=data['ee_db_name'],
                                    dbuser=data['ee_db_user'],
                                    dbhost=data['ee_mysql_grant_host'])
                    deleteSiteInfo(self, ee_domain)
                    Log.error(self, "Check logs for reason "
                              "`tail /var/log/ee/ee.log` & Try Again!!!")

            # Service Nginx Reload call cleanup if failed to reload nginx
            if not EEService.reload_service(self, 'nginx'):
                Log.info(self, Log.FAIL + "Oops Something went wrong !!")
                Log.info(self, Log.FAIL + "Calling cleanup actions ...")
                doCleanupAction(self, domain=ee_domain,
                                webroot=data['webroot'])
                if 'ee_db_name' in data.keys():
                    doCleanupAction(self, domain=ee_domain,
                                    dbname=data['ee_db_name'],
                                    dbuser=data['ee_db_user'],
                                    dbhost=data['ee_mysql_grant_host'])
                deleteSiteInfo(self, ee_domain)
                Log.info(self, Log.FAIL + "service nginx reload failed."
                         " check issues with `nginx -t` command.")
                Log.error(self, "Check logs for reason "
                          "`tail /var/log/ee/ee.log` & Try Again!!!")

            EEGit.add(self, ["/etc/nginx"],
                      msg="{0} created with {1} {2}"
                      .format(ee_www_domain, stype, cache))
            # Setup Permissions for webroot
            try:
                setwebrootpermissions(self, data['webroot'])
            except SiteError as e:
                Log.debug(self, str(e))
                Log.info(self, Log.FAIL + "Oops Something went wrong !!")
                Log.info(self, Log.FAIL + "Calling cleanup actions ...")
                doCleanupAction(self, domain=ee_domain,
                                webroot=data['webroot'])
                if 'ee_db_name' in data.keys():
                    print("Inside db cleanup")
                    doCleanupAction(self, domain=ee_domain,
                                    dbname=data['ee_db_name'],
                                    dbuser=data['ee_db_user'],
                                    dbhost=data['ee_mysql_grant_host'])
                deleteSiteInfo(self, ee_domain)
                Log.error(self, "Check logs for reason "
                          "`tail /var/log/ee/ee.log` & Try Again!!!")

            if ee_auth and len(ee_auth):
                for msg in ee_auth:
                    Log.info(self, Log.ENDC + msg, log=False)

            if data['wp']:
                Log.info(self, Log.ENDC + "WordPress admin user :"
                         " {0}".format(ee_wp_creds['wp_user']), log=False)
                Log.info(self, Log.ENDC + "WordPress admin user password : {0}"
                         .format(ee_wp_creds['wp_pass']), log=False)

                display_cache_settings(self, data)

            Log.info(self, "Successfully created site"
                     " http://{0}".format(ee_domain))
        except SiteError as e:
            Log.error(self, "Check logs for reason "
                      "`tail /var/log/ee/ee.log` & Try Again!!!")

        if self.app.pargs.letsencrypt :
            if (not self.app.pargs.experimental):
                if ['wpsubdomain'] in stype:
	                    Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.")

                Log.info(self, "Letsencrypt is currently in beta phase."
                             " \nDo you wish"
                             " to enable SSl now for {0}?".format(ee_domain))

                # Check prompt
                check_prompt = input("Type \"y\" to continue [n]:")
                if check_prompt != "Y" and check_prompt != "y":
                    data['letsencrypt'] = False
                    letsencrypt = False
                else:
                    data['letsencrypt'] = True
                    letsencrypt = True
            else:
                 data['letsencrypt'] = True
                 letsencrypt = True

            if data['letsencrypt'] is True:
                 setupLetsEncrypt(self, ee_domain)
                 httpsRedirect(self,ee_domain)
                 Log.info(self,"Creating Cron Job for cert auto-renewal")
                 EECron.setcron_weekly(self,'ee site update --le=renew --all 2> /dev/null'.format(ee_domain),'Renew all'
                                                                     ' letsencrypt SSL cert. Set by EasyEngine')

                 if not EEService.reload_service(self, 'nginx'):
                    Log.error(self, "service nginx reload failed. "
                          "check issues with `nginx -t` command")

                 Log.info(self, "Congratulations! Successfully Configured SSl for Site "
                         " https://{0}".format(ee_domain))

                 if (SSL.getExpirationDays(self,ee_domain)>0):
                    Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,ee_domain)) + " days.")
                 else:
                    Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ")

                 # Add nginx conf folder into GIT
                 EEGit.add(self, ["{0}/conf/nginx".format(ee_site_webroot)],
                          msg="Adding letsencrypts config of site: {0}"
                        .format(ee_domain))
                 updateSiteInfo(self, ee_domain, ssl=letsencrypt)

            elif data['letsencrypt'] is False:
                Log.info(self, "Not using Let\'s encrypt for Site "
                         " http://{0}".format(ee_domain))
dataset/ETHPy150Open EasyEngine/easyengine/ee/cli/plugins/site.py/EESiteCreateController.default/swapped operands of `in`