diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index a39e4d82..9e31aabe 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -67,10 +67,10 @@ class EEStackController(CementBaseController): def pre_pref(self, apt_packages): if set(EEVariables.ee_postfix).issubset(set(apt_packages)): print("Pre-seeding postfix variables ... ") - EEShellExec.cmd_exec("echo \"postfix postfix/main_mailer_type " - "string 'Internet Site'\" | " + EEShellExec.cmd_exec(self, "echo \"postfix postfix " + "/main_mailer_typestring 'Internet Site'\" | " "debconf-set-selections") - EEShellExec.cmd_exec("echo \"postfix postfix/mailname string " + EEShellExec.cmd_exec(self, "echo \"postfix postfix/mailname string" "$(hostname -f)\" | debconf-set-selections") if set(EEVariables.ee_mysql).issubset(set(apt_packages)): print("Adding repository for MySQL ... ") @@ -79,11 +79,11 @@ class EEStackController(CementBaseController): EERepo.add_key('1C4CBDCDCD2EFD2A') chars = ''.join(random.sample(string.ascii_letters, 8)) print("Pre-seeding MySQL variables ... ") - EEShellExec.cmd_exec("echo \"percona-server-server-5.6 " + EEShellExec.cmd_exec(self, "echo \"percona-server-server-5.6 " "percona-server-server/root_password " "password {chars}\" | " "debconf-set-selections".format(chars=chars)) - EEShellExec.cmd_exec("echo \"percona-server-server-5.6 " + EEShellExec.cmd_exec(self, "echo \"percona-server-server-5.6 " "percona-server-server/root_password_again " "password {chars}\" | " "debconf-set-selections".format(chars=chars)) @@ -101,7 +101,8 @@ class EEStackController(CementBaseController): if set(EEVariables.ee_nginx).issubset(set(apt_packages)): print("Adding repository for Nginx ... ") if EEVariables.ee_platform_distro == 'Debian': - self.app.log.debug('Adding Dotdeb/nginx GPG key') + s + elf.app.log.debug('Adding Dotdeb/nginx GPG key') EERepo.add(repo_url=EEVariables.ee_nginx_repo) else: self.app.log.debug('Adding ppa of Nginx') @@ -123,11 +124,11 @@ class EEStackController(CementBaseController): print("Adding repository for dovecot ... ") EERepo.add(repo_url=EEVariables.ee_dovecot_repo) self.app.log.debug('Executing the command debconf-set-selections.') - EEShellExec.cmd_exec("echo \"dovecot-core dovecot-core/" + EEShellExec.cmd_exec(self, "echo \"dovecot-core dovecot-core/" "create-ssl-cert boolean yes\" " "| debconf-set-selections") - EEShellExec.cmd_exec("echo \"dovecot-core dovecot-core/ssl-cert-" - "name string $(hostname -f)\"" + EEShellExec.cmd_exec(self, "echo \"dovecot-core dovecot-core" + "/ssl-cert-name string $(hostname -f)\"" " | debconf-set-selections") @expose(hide=True) @@ -213,17 +214,20 @@ class EEStackController(CementBaseController): if set(EEVariables.ee_mail).issubset(set(apt_packages)): self.app.log.debug("Executing mail commands") - EEShellExec.cmd_exec("adduser --uid 5000 --home /var/vmail" - "--disabled-password --gecos '' vmail") - EEShellExec.cmd_exec("openssl req -new -x509 -days 3650 -nodes" - " -subj /commonName={HOSTNAME}/emailAddre" - "ss={EMAIL} -out /etc/ssl/certs/dovecot." + EEShellExec.cmd_exec(self, "adduser --uid 5000 --home /var" + "/vmail--disabled-password --gecos ''" + " vmail") + EEShellExec.cmd_exec(self, "openssl req -new -x509 -days 3650 " + "-nodes -subj /commonName={HOSTNAME}" + "/emailAddre ss={EMAIL} -out /etc/ssl" + "/certs/dovecot." "pem -keyout /etc/ssl/private/dovecot.pem" .format(HOSTNAME=EEVariables.ee_fqdn, EMAIL=EEVariables.ee_email)) self.app.log.debug("Adding Privillages to file " "/etc/ssl/private/dovecot.pem ") - EEShellExec.cmd_exec("chmod 0600 /etc/ssl/private/dovecot.pem") + EEShellExec.cmd_exec(self, "chmod 0600 /etc/ssl/private" + "/dovecot.pem") # Custom Dovecot configuration by EasyEngine data = dict() @@ -236,24 +240,28 @@ class EEStackController(CementBaseController): # Custom Postfix configuration needed with Dovecot # Changes in master.cf # TODO: Find alternative for sed in Python - EEShellExec.cmd_exec("sed -i \'s/#submission/submission/\'" + EEShellExec.cmd_exec(self, "sed -i \'s/#submission/submission" + "/\'" " /etc/postfix/master.cf") - EEShellExec.cmd_exec("sed -i \'s/#smtps/smtps/\'" + EEShellExec.cmd_exec(self, "sed -i \'s/#smtps/smtps/\'" " /etc/postfix/master.cf") - EEShellExec.cmd_exec("postconf -e \"smtpd_sasl_type = " + EEShellExec.cmd_exec(self, "postconf -e \"smtpd_sasl_type = " "dovecot\"") - EEShellExec.cmd_exec("postconf -e \"smtpd_sasl_path = " + EEShellExec.cmd_exec(self, "postconf -e \"smtpd_sasl_path = " "private/auth\"") - EEShellExec.cmd_exec("postconf -e \"smtpd_sasl_auth_enable = " + EEShellExec.cmd_exec(self, "postconf -e \"" + "smtpd_sasl_auth_enable = " "yes\"") - EEShellExec.cmd_exec("postconf -e \"smtpd_relay_restrictions =" - " permit_sasl_authenticated, " - "permit_mynetworks, " - "reject_unauth_destination\"") - EEShellExec.cmd_exec("postconf -e \"smtpd_tls_mandatory_" - "protocols = !SSLv2,!SSLv3\"") - EEShellExec.cmd_exec("postconf -e \"smtp_tls_mandatory_" + EEShellExec.cmd_exec(self, "postconf -e \"" + "smtpd_relay_restrictions =" + "permit_sasl_authenticated, " + "permit_mynetworks, " + "reject_unauth_destination\"") + "protocols = !SSLv2,!SSLv3\"") + EEShellExec.cmd_exec(self, "postconf -e \"" + "smtpd_tls_mandatory_") + EEShellExec.cmd_exec(self, "postconf -e \"smtp_tls_mandatory_" "protocols = !SSLv2,!SSLv3\"") EEShellExec.cmd_exec("postconf -e \"smtpd_tls_protocols " "= !SSLv2,!SSLv3\"") @@ -348,7 +356,7 @@ class EEStackController(CementBaseController): EEShellExec.cmd_exec("chmod +x /usr/bin/wp") if any('/tmp/pma.tar.gz' == x[1] for x in packages): - EEExtract.extract('/tmp/pma.tar.gz', '/tmp/') + EEExtract.extract(self, '/tmp/pma.tar.gz', '/tmp/') self.app.log.debug('Extracting file /tmp/pma.tar.gz to ' 'loaction /tmp/') if not os.path.exists('/var/www/22222/htdocs/db'): @@ -365,7 +373,7 @@ class EEStackController(CementBaseController): for x in packages): self.app.log.debug("Extracting memcache.tar.gz to location" " /var/www/22222/htdocs/cache/memcache ") - EEExtract.extract('/tmp/memcache.tar.gz', + EEExtract.extract(self, '/tmp/memcache.tar.gz', '/var/www/22222/htdocs/cache/memcache') self.app.log.debug("Privillages to" " /var/www/22222/htdocs/cache/memcache") @@ -376,7 +384,7 @@ class EEStackController(CementBaseController): for x in packages): self.app.log.debug("Extracting file webgrind.tar.gz to " "location /tmp/ ") - EEExtract.extract('/tmp/webgrind.tar.gz', '/tmp/') + EEExtract.extract(self, '/tmp/webgrind.tar.gz', '/tmp/') if not os.path.exists('/var/www/22222/htdocs/php'): self.app.log.debug("Creating directroy " "/var/www/22222/htdocs/php") @@ -392,7 +400,7 @@ class EEStackController(CementBaseController): for x in packages): self.app.log.debug("Extracting file anemometer.tar.gz to " "location /tmp/ ") - EEExtract.extract('/tmp/anemometer.tar.gz', '/tmp/') + EEExtract.extract(self, '/tmp/anemometer.tar.gz', '/tmp/') if not os.path.exists('/var/www/22222/htdocs/db/'): self.app.log.debug("Creating directory") os.makedirs('/var/www/22222/htdocs/db/') @@ -401,9 +409,9 @@ class EEStackController(CementBaseController): chars = ''.join(random.sample(string.ascii_letters, 8)) EEShellExec.cmd_exec('mysql < /var/www/22222/htdocs/db' '/anemometer/install.sql') - EEMysql.execute('grant select on *.* to \'anemometer\'' + EEMysql.execute(self, 'grant select on *.* to \'anemometer\'' '@\'localhost\'') - EEMysql.execute('grant all on slow_query_log.* to' + EEMysql.execute(self, 'grant all on slow_query_log.* to' '\'anemometer\'@\'localhost\' IDENTIFIED' ' BY \''+chars+'\'') @@ -425,7 +433,7 @@ class EEStackController(CementBaseController): # Extract ViMbAdmin self.app.log.debug("Extracting ViMbAdmin.tar.gz to " "location /tmp/") - EEExtract.extract('/tmp/vimbadmin.tar.gz', '/tmp/') + EEExtract.extract(self, '/tmp/vimbadmin.tar.gz', '/tmp/') if not os.path.exists('/var/www/22222/htdocs/'): self.app.log.debug("Creating directory " " /var/www/22222/htdocs/") @@ -448,9 +456,10 @@ class EEStackController(CementBaseController): # Configure vimbadmin database vm_passwd = ''.join(random.sample(string.ascii_letters, 8)) self.app.log.debug("Creating vimbadmin database if not exist") - EEMysql.execute("create database if not exists vimbadmin") + EEMysql.execute(self, "create database if not exists" + " vimbadmin") self.app.log.debug("Granting all privileges on vimbadmin ") - EEMysql.execute("grant all privileges on vimbadmin.* to" + EEMysql.execute(self, "grant all privileges on vimbadmin.* to" " vimbadmin@localhost IDENTIFIED BY" " '{password}'".format(password=vm_passwd)) @@ -502,8 +511,8 @@ class EEStackController(CementBaseController): "/var/www/22222/htdocs/vimbadmin/bin" "/doctrine2-cli.php orm:schema-tool:" "create") - EEShellExec.cmd_exec("/var/www/22222/htdocs/vimbadmin/bin" - "/doctrine2-cli.php orm:schema-tool:" + EEShellExec.cmd_exec(self, "/var/www/22222/htdocs/vimbadmin" + "/bin/doctrine2-cli.php orm:schema-tool:" "create") # Copy Dovecot and Postfix templates which are depednet on @@ -558,7 +567,7 @@ class EEStackController(CementBaseController): # Extract RoundCubemail self.app.log.debug("Extracting file /tmp/roundcube.tar.gz " "to location /tmp/ ") - EEExtract.extract('/tmp/roundcube.tar.gz', '/tmp/') + EEExtract.extract(self, '/tmp/roundcube.tar.gz', '/tmp/') if not os.path.exists('/var/www/roundcubemail'): self.app.log.debug("Creating new directory " " /var/www/roundcubemail/") @@ -569,12 +578,14 @@ class EEStackController(CementBaseController): # Configure roundcube database rc_passwd = ''.join(random.sample(string.ascii_letters, 8)) self.app.log.debug("Creating Database roundcubemail") - EEMysql.execute("create database if not exists roundcubemail") + EEMysql.execute(self, "create database if not exists " + " roundcubemail") self.app.log.debug("Grant all privileges on roundcubemail") - EEMysql.execute("grant all privileges on roundcubemail.* to " + EEMysql.execute(self, "grant all privileges" + " on roundcubemail.* to " " roundcube@localhost IDENTIFIED BY " "'{password}'".format(password=rc_passwd)) - EEShellExec.cmd_exec("mysql roundcubemail < /var/www/" + EEShellExec.cmd_exec(self, "mysql roundcubemail < /var/www/" "roundcubemail/htdocs/SQL/mysql" ".initial.sql") @@ -582,21 +593,22 @@ class EEStackController(CementBaseController): "config.inc.php.sample", "/var/www/roundcubemail/htdocs/config/" "config.inc.php") - EEShellExec.cmd_exec("sed -i \"s\'mysql://roundcube:pass@" - "localhost/roundcubemail\'mysql://" + EEShellExec.cmd_exec(self, "sed -i \"s\'mysql://roundcube:" + "pass@localhost/roundcubemail\'mysql://" "roundcube:{password}@localhost/" "roundcubemail\'\" /var/www/roundcubemail" "/htdocs/config/config." "inc.php".format(password=rc_passwd)) # Sieve plugin configuration in roundcube - EEShellExec.cmd_exec("sed -i \"s:\$config\['plugins'\] = array" - "(:\$config\['plugins'\] = array(\n " - "'sieverules',:\" /var/www/roundcubemail" + EEShellExec.cmd_exec(self, "sed -i \"s:\$config\['plugins'\] " + "= array(:\$config\['plugins'\] = " + "array(\n'sieverules',:\" /var/www" + "/roundcubemail/htdocs/config" + "/config.inc.php") + EEShellExec.cmd_exec(self, "echo \"\$config['sieverules_port']" + "=4190;\" >> /var/www/roundcubemail" "/htdocs/config/config.inc.php") - EEShellExec.cmd_exec("echo \"\$config['sieverules_port'] = " - "4190;\" >> /var/www/roundcubemail/htdocs" - "/config/config.inc.php") @expose() def install(self): @@ -697,7 +709,7 @@ class EEStackController(CementBaseController): pkg.install(apt_packages) if len(packages): self.app.log.debug("Downloading all packages") - EEDownload.download(packages) + EEDownload.download(self, packages) self.app.log.debug("Calling post_pref") self.post_pref(apt_packages, packages) @@ -751,9 +763,9 @@ class EEStackController(CementBaseController): if len(apt_packages): self.app.log.debug("Removing apt_packages") - pkg.remove(apt_packages) + pkg.remove(self, apt_packages) if len(packages): - EEFileUtils.remove(packages) + EEFileUtils.remove(self, packages) @expose() def purge(self): @@ -804,9 +816,9 @@ class EEStackController(CementBaseController): ] if len(apt_packages): - pkg.remove(apt_packages, purge=True) + pkg.remove(self, apt_packages, purge=True) if len(packages): - EEFileUtils.remove(packages) + EEFileUtils.remove(self, packages) def load(app): diff --git a/ee/cli/plugins/stack_services.py b/ee/cli/plugins/stack_services.py index ee23866c..650027b1 100644 --- a/ee/cli/plugins/stack_services.py +++ b/ee/cli/plugins/stack_services.py @@ -20,18 +20,25 @@ class EEStackStatusController(CementBaseController): def start(self): services = [] if self.app.pargs.nginx: + self.app.log.debug("nginx service start") services = services + ['nginx'] elif self.app.pargs.php: + self.app.log.debug("php5-fpm service start") services = services + ['php5-fpm'] elif self.app.pargs.mysql: + self.app.log.debug("mysql service start") services = services + ['mysql'] elif self.app.pargs.postfix: + self.app.log.debug("postfix service start") services = services + ['postfix'] elif self.app.pargs.memcache: + self.app.log.debug("memcached service start") services = services + ['memcached'] elif self.app.pargs.dovecot: + self.app.log.debug("dovecot service start") services = services + ['dovecot'] else: + self.app.log.debug("nginx,php5-fpm,mysql,postfix services start") services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix'] for service in services: EEService.start_service(self, service) @@ -40,19 +47,26 @@ class EEStackStatusController(CementBaseController): def stop(self): services = [] if self.app.pargs.nginx: + self.app.log.debug("nginx service stop") services = services + ['nginx'] elif self.app.pargs.php: + self.app.log.debug("php5-fpm service stop") services = services + ['php5-fpm'] elif self.app.pargs.mysql: + self.app.log.debug("mysql service stop") services = services + ['mysql'] elif self.app.pargs.postfix: + self.app.log.debug("postfix service stop") services = services + ['postfix'] elif self.app.pargs.memcache: + self.app.log.debug("memcached service stop") services = services + ['memcached'] elif self.app.pargs.dovecot: + self.app.log.debug("dovecot service stop") services = services + ['dovecot'] else: services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix'] + self.app.log.debug("nginx,php5-fpm,mysql,postfix services stop") for service in services: EEService.stop_service(self, service) @@ -60,38 +74,52 @@ class EEStackStatusController(CementBaseController): def restart(self): services = [] if self.app.pargs.nginx: + self.app.log.debug("nginx service restart") services = services + ['nginx'] elif self.app.pargs.php: + self.app.log.debug("php5-fpm service restart") services = services + ['php5-fpm'] elif self.app.pargs.mysql: + self.app.log.debug("mysql service restart") services = services + ['mysql'] elif self.app.pargs.postfix: + self.app.log.debug("postfix service restart") services = services + ['postfix'] elif self.app.pargs.memcache: + self.app.log.debug("memcached service restart") services = services + ['memcached'] elif self.app.pargs.dovecot: + self.app.log.debug("dovecot service restart") services = services + ['dovecot'] else: services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix'] for service in services: + self.app.log.debug("nginx,php5-fpm,mysql,postfix services restart") EEService.restart_service(self, service) @expose(help="get stack status") def status(self): services = [] if self.app.pargs.nginx: + self.app.log.debug("nginx service status") services = services + ['nginx'] elif self.app.pargs.php: + self.app.log.debug("php5-fpm service status") services = services + ['php5-fpm'] elif self.app.pargs.mysql: + self.app.log.debug("mysql service status") services = services + ['mysql'] elif self.app.pargs.postfix: services = services + ['postfix'] + self.app.log.debug("postfix service status") elif self.app.pargs.memcache: + self.app.log.debug("memcached service status") services = services + ['memcached'] elif self.app.pargs.dovecot: + self.app.log.debug("dovecot service status") services = services + ['dovecot'] else: + self.app.log.debug("nginx,php5-fpm,mysql,postfix services status") services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix'] for service in services: if EEService.get_service_status(self, service): diff --git a/ee/core/aptget.py b/ee/core/aptget.py index efa35f41..72bd7f18 100644 --- a/ee/core/aptget.py +++ b/ee/core/aptget.py @@ -13,6 +13,7 @@ class EEAptGet: def update(self): """Similar to apt-get update""" + self.app.log.debug("Update cache") self.cache.update(self.fprogress) self.cache.open() @@ -201,16 +202,19 @@ class EEAptGet: # Check if packages available for remove/update. if self.cache.delete_count > 0: + self.app.log.debug('packages will be REMOVED ') print("The following packages will be REMOVED:" "\n {pkg_name}" .format(pkg_name=my_selected_packages)) print("{pkg_remove_count} to remove." .format(pkg_remove_count=self.cache.delete_count)) + self.app.log.debug('bytes disk space will be freed') print("After this operation, {space} bytes disk spac" "e will be freed.".format(space=self.cache.required_space)) try: self.cache.commit(self.fprogress, self.iprogress) except Exception as e: + self.app.log.error('Sorry, package installation failed ') print("Sorry, package installation failed [{err}]" .format(err=str(e))) return(False) diff --git a/ee/core/download.py b/ee/core/download.py index ff6291da..2ab6375b 100644 --- a/ee/core/download.py +++ b/ee/core/download.py @@ -9,7 +9,7 @@ class EEDownload(): def __init__(): pass - def download(packages): + def download(self, packages): for package in packages: url = package[0] filename = package[1] @@ -17,18 +17,25 @@ class EEDownload(): directory = os.path.dirname(filename) if not os.path.exists(directory): os.makedirs(directory) - print("Downloading "+os.path.basename(url)+" ...") + self.app.log.info("Downloading "+os.path.basename(url)+" ...") urllib.request.urlretrieve(url, filename) - print("Done") + self.app.log.info("Done") except urllib.error.URLError as e: - print("Unable to donwload file, [{err}]" - .format(err=str(e.reason))) + self.app.log.error("Error is :" + + os.path.basename(url)+e.reason()) + self.app.log.info("Unable to donwload file, [{err}]" + .format(err=str(e.reason))) return False except urllib.error.HTTPError as e: - print("Package download failed. [{err}]" - .format(err=str(e.reason))) + self.app.log.error("Package download failed", e.reason()) + self.app.log.info("Package download failed. [{err}]" + .format(err=str(e.reason))) return False except urllib.error.ContentTooShortError as e: - print("Package download failed. The amount of the" - "downloaded data is less than the expected amount") + self.app.log.error("Package download failed. The amount of the" + " downloaded data is less than " + "the expected amount"+e.reason()) + self.app.log.info("Package download failed. The amount of the" + "downloaded data is less than" + " the expected amount") return False diff --git a/ee/core/extract.py b/ee/core/extract.py index 48fbc138..ab5d9169 100644 --- a/ee/core/extract.py +++ b/ee/core/extract.py @@ -6,7 +6,7 @@ import os class EEExtract(): """Method to extract from tar.gz file""" - def extract(file, path): + def extract(self, file, path): try: tar = tarfile.open(file) tar.extractall(path=path) @@ -14,5 +14,6 @@ class EEExtract(): os.remove(file) return True except tarfile.TarError as e: - print("Unable to extract file "+file) + self.app.log.error('Unable to extract file', e.reason()) + self.app.log.info("Unable to extract file "+file) return False diff --git a/ee/core/fileutils.py b/ee/core/fileutils.py index 4853d01b..9b32c417 100644 --- a/ee/core/fileutils.py +++ b/ee/core/fileutils.py @@ -8,18 +8,23 @@ class EEFileUtils(): def __init__(): pass - def remove(filelist): + def remove(self, filelist): for file in filelist: if os.path.isfile(file): - print("Removing "+os.path.basename(file)+" ...") + self.app.log.debug('Removing file') + self.app.log.info("Removing "+os.path.basename(file)+" ...") os.remove(file) - print("Done") + self.app.log.debug('file Removed') + self.app.log.info("Done") if os.path.isdir(file): try: + self.app.log.debug('Removing file') print("Removing "+os.path.basename(file)+" ...") shutil.rmtree(file) - print("Done") + self.app.log.info("Done") except shutil.Error as e: - print("Unable to remove file, [{err}]" - .format(err=str(e.reason))) + self.app.log.error('Unable to Remove file' + + os.path.basename(file)+e.reason()) + self.app.log.info("Unable to remove file, [{err}]" + .format(err=str(e.reason))) return False diff --git a/ee/core/mysql.py b/ee/core/mysql.py index 59e6c802..19381f4b 100644 --- a/ee/core/mysql.py +++ b/ee/core/mysql.py @@ -7,7 +7,7 @@ from os.path import expanduser class EEMysql(): """Method for MySQL connection""" - def execute(statement): + def execute(self, statement): config = configparser.RawConfigParser() cnfpath = expanduser("~")+"/.my.cnf" if [cnfpath] == config.read(cnfpath): @@ -28,13 +28,15 @@ class EEMysql(): user=user, passwd=passwd) cur = conn.cursor() except Exception as e: - print("Unable to connect to database") + self.app.log.error('Unable to connect to database', e.reason()) + self.app.log.info("Unable to connect to database") return False try: cur.execute(statement) except Exception as e: - print("Error occured while executing "+statement) + self.app.log.error('Error occured while executing', e.reason()) + self.app.log.info("Error occured while executing "+statement) cur.close() conn.close() return False diff --git a/ee/core/services.py b/ee/core/services.py index 99638476..e6b8de58 100644 --- a/ee/core/services.py +++ b/ee/core/services.py @@ -16,7 +16,7 @@ class EEService(): retcode = subprocess.getstatusoutput('service {0} start' .format(service_name)) if retcode[0] == 0: - print("Started : {0}".format(service_name)) + self.app.log.info("Started : {0}".format(service_name)) else: self.app.log.error(retcode[1]) except OSError as e: @@ -28,7 +28,7 @@ class EEService(): retcode = subprocess.getstatusoutput('service {0} stop' .format(service_name)) if retcode[0] == 0: - print("Stopped : {0}".format(service_name)) + self.app.log.info("Stopped : {0}".format(service_name)) return True else: return False diff --git a/ee/core/shellexec.py b/ee/core/shellexec.py index 301ae4c1..1b9f6e98 100644 --- a/ee/core/shellexec.py +++ b/ee/core/shellexec.py @@ -10,14 +10,14 @@ class EEShellExec(): def __init__(): pass - def cmd_exec(command): + def cmd_exec(self, command): try: retcode = subprocess.getstatusoutput(command) if retcode[0] == 0: return True else: - print(retcode[1]) + self.app.log.info(retcode[1]) return False except OSError as e: - print(e) + self.app.log.info(e) return False diff --git a/ee/core/variables.py b/ee/core/variables.py index f6fe0d05..1cbd96c6 100644 --- a/ee/core/variables.py +++ b/ee/core/variables.py @@ -25,6 +25,7 @@ class EEVariables(): ee_user = config['user']['name'] ee_email = config['user']['email'] except KeyError as e: + self.app.log.error('Unable to find GIT user name and Email', e) print("Unable to find GIT user name and Email") sys.exit(1)