def edit(self): if not self.app.pargs.site_name: try: while not self.app.pargs.site_name: self.app.pargs.site_name = (input('Enter site name : ') .strip()) except IOError as e: Log.error(self, 'Unable to read input, 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 check_domain_exists(self, ee_domain): Log.error(self, "site {0} does not exist".format(ee_domain)) if os.path.isfile('/etc/nginx/sites-available/{0}' .format(ee_domain)): try: EEShellExec.invoke_editor(self, '/etc/nginx/sites-available/' '{0}'.format(ee_domain)) except CommandExecutionError as e: Log.error(self, "Failed invoke editor") if (EEGit.checkfilestatus(self, "/etc/nginx", '/etc/nginx/sites-available/{0}'.format(ee_domain))): EEGit.add(self, ["/etc/nginx"], msg="Edit website: {0}" .format(ee_domain)) # Reload NGINX EEService.reload_service(self, 'nginx') else: Log.error(self, "nginx configuration file does not exists" .format(ee_domain))