本文整理汇总了Python中sss.core.logging.Log.debug方法的典型用法代码示例。如果您正苦于以下问题:Python Log.debug方法的具体用法?Python Log.debug怎么用?Python Log.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sss.core.logging.Log
的用法示例。
在下文中一共展示了Log.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setwebrootpermissions
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def setwebrootpermissions(self, webroot):
Log.debug(self, "Setting up permissions")
try:
SSSFileUtils.chown(self, webroot, SSSVariables.sss_php_user, SSSVariables.sss_php_user, recursive=True)
except Exception as e:
Log.debug(self, str(e))
raise SiteError("problem occured while setting up webroot permissions")
示例2: secure_auth
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def secure_auth(self):
"""This function Secures authentication"""
passwd = ''.join([random.choice
(string.ascii_letters + string.digits)
for n in range(6)])
if not self.app.pargs.user_input:
username = input("Provide HTTP authentication user "
"name [{0}] :".format(SSSVariables.sss_user))
self.app.pargs.user_input = username
if username == "":
self.app.pargs.user_input = SSSVariables.sss_user
if not self.app.pargs.user_pass:
password = getpass.getpass("Provide HTTP authentication "
"password [{0}] :".format(passwd))
self.app.pargs.user_pass = password
if password == "":
self.app.pargs.user_pass = passwd
Log.debug(self, "printf username:"
"$(openssl passwd -crypt "
"password 2> /dev/null)\n\""
"> /etc/apache2/htpasswd-sss 2>/dev/null")
SSSShellExec.cmd_exec(self, "printf \"{username}:"
"$(openssl passwd -crypt "
"{password} 2> /dev/null)\n\""
"> /etc/apache2/htpasswd-sss 2>/dev/null"
.format(username=self.app.pargs.user_input,
password=self.app.pargs.user_pass),
log=False)
SSSGit.add(self, ["/etc/apache2"],
msg="Adding changed secure auth into Git")
示例3: removeApacheConf
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def removeApacheConf(self, domain):
if os.path.isfile("/etc/apache2/sites-available/{0}.conf".format(domain)):
Log.debug(self, "Removing Apache configuration")
SSSFileUtils.rm(self, "/etc/apache2/sites-enabled/{0}.conf".format(domain))
SSSFileUtils.rm(self, "/etc/apache2/sites-available/{0}.conf".format(domain))
SSSService.reload_service(self, "apache2")
SSSGit.add(self, ["/etc/apache2"], msg="Deleted {0} ".format(domain))
示例4: add
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def add(self, paths, msg="Intializating"):
"""
Initializes Directory as repository if not already git repo.
and adds uncommited changes automatically
"""
for path in paths:
global git
git = git.bake("--git-dir={0}/.git".format(path), "--work-tree={0}".format(path))
if os.path.isdir(path):
if not os.path.isdir(path + "/.git"):
try:
Log.debug(self, "SSS Git: git init at {0}".format(path))
git.init(path)
except ErrorReturnCode as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to git init at {0}".format(path))
status = git.status("-s")
if len(status.splitlines()) > 0:
try:
Log.debug(self, "SSS Git: git commit at {0}".format(path))
git.add("--all")
git.commit("-am {0}".format(msg))
except ErrorReturnCode as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to git commit at {0} ".format(path))
else:
Log.debug(self, "SSS Git: Path {0} not present".format(path))
示例5: remove
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def remove(self, ppa=None, repo_url=None):
"""
This function used to remove ppa's
If ppa is provided adds repo file to
/etc/apt/sources.list.d/
command.
"""
if ppa:
SSSShellExec.cmd_exec(self, "add-apt-repository -y "
"--remove '{ppa_name}'"
.format(ppa_name=ppa))
elif repo_url:
repo_file_path = ("/etc/apt/sources.list.d/"
+ SSSVariables().sss_repo_file)
try:
repofile = open(repo_file_path, "w+")
repofile.write(repofile.read().replace(repo_url, ""))
repofile.close()
except IOError as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "File I/O error.")
except Exception as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to remove repo")
示例6: reload_service
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def reload_service(self, service_name):
"""
Stop service
Similar to `service xyz stop`
"""
try:
if service_name in ['php5-fpm']:
service_cmd = ('{0} -t && service {0} reload'
.format(service_name))
else:
service_cmd = ('service {0} reload'.format(service_name))
Log.info(self, "Reload : {0:10}".format(service_name), end='')
retcode = subprocess.getstatusoutput(service_cmd)
if retcode[0] == 0:
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKGREEN + "]")
return True
else:
Log.debug(self, "{0}".format(retcode[1]))
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKGREEN+"]")
return False
except OSError as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "\nFailed to reload service {0}"
.format(service_name))
示例7: invoke_editor
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def invoke_editor(self, filepath, errormsg=''):
"""
Open files using sensible editor
"""
try:
subprocess.call(['sensible-editor', filepath])
except OSError as e:
Log.debug(self, "{0}{1}".format(e.errno, e.strerror))
raise CommandExecutionError
示例8: check_db_exists
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def check_db_exists(self, db_name):
try:
if SSSMysql.dbConnection(self, db_name):
return True
except DatabaseNotExistsError as e:
Log.debug(self, str(e))
return False
except MySQLConnectionError as e:
Log.debug(self, str(e))
raise MySQLConnectionError
示例9: auto_remove
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def auto_remove(self):
"""
Similar to `apt-get autoremove`
"""
try:
Log.debug(self, "Running apt-get autoremove")
apt_get.autoremove("-y")
except ErrorReturnCode as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to apt-get autoremove")
示例10: remove_symlink
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def remove_symlink(self, filepath):
"""
Removes symbolic link for the path provided with filepath
"""
try:
Log.debug(self, "Removing symbolic link: {0}".format(filepath))
os.unlink(filepath)
except Exception as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to reomove symbolic link ...\n")
示例11: getSiteInfo
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def getSiteInfo(self, site):
"""
Retrieves site record from sss databse
"""
try:
q = SiteDB.query.filter(SiteDB.sitename == site).first()
return q
except Exception as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to query database for site info")
示例12: getAllsites
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def getAllsites(self):
"""
1. returns all records from sss database
"""
try:
q = SiteDB.query.all()
return q
except Exception as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to query database")
示例13: pre_run_checks
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def pre_run_checks(self):
# Check Apache configuration
Log.info(self, "Running pre-update checks, please wait...")
try:
Log.debug(self, "checking Apache configuration ...")
FNULL = open("/dev/null", "w")
ret = subprocess.check_call(["apachectl", "configtest"], stdout=FNULL, stderr=subprocess.STDOUT)
except CalledProcessError as e:
Log.debug(self, "{0}".format(str(e)))
raise SiteError("Apache configuration check failed.")
示例14: updateSiteInfo
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def updateSiteInfo(self, site, stype='', cache='', webroot='',
enabled=True, ssl=False, fs='', db='', db_name=None,
db_user=None, db_password=None, db_host=None, hhvm=None,
pagespeed=None):
"""updates site record in database"""
try:
q = SiteDB.query.filter(SiteDB.sitename == site).first()
except Exception as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to query database for site info")
if not q:
Log.error(self, "{0} does not exist in database".format(site))
# Check if new record matches old if not then only update database
if stype and q.site_type != stype:
q.site_type = stype
if cache and q.cache_type != cache:
q.cache_type = cache
if q.is_enabled != enabled:
q.is_enabled = enabled
if ssl and q.is_ssl != ssl:
q.is_ssl = ssl
if db_name and q.db_name != db_name:
q.db_name = db_name
if db_user and q.db_user != db_user:
q.db_user = db_user
if db_user and q.db_password != db_password:
q.db_password = db_password
if db_host and q.db_host != db_host:
q.db_host = db_host
if webroot and q.site_path != webroot:
q.site_path = webroot
if (hhvm is not None) and (q.is_hhvm is not hhvm):
q.is_hhvm = hhvm
if (pagespeed is not None) and (q.is_pagespeed is not pagespeed):
q.is_pagespeed = pagespeed
try:
q.created_on = func.now()
db_session.commit()
except Exception as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to update site info in application database.")
示例15: isexist
# 需要导入模块: from sss.core.logging import Log [as 别名]
# 或者: from sss.core.logging.Log import debug [as 别名]
def isexist(self, path):
"""
Check if file exist on given path
"""
try:
if os.path.exists(path):
return (True)
else:
return (False)
except OSError as e:
Log.debug(self, "{0}".format(e.strerror))
Log.error(self, "Unable to check path {0}".format(path))