当前位置: 首页>>代码示例>>Python>>正文


Python Log.debug方法代码示例

本文整理汇总了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")
开发者ID:serversetup,项目名称:SetupServer,代码行数:9,代码来源:site_functions.py

示例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")
开发者ID:harshiljethava,项目名称:TestingSimpleSetupServer,代码行数:32,代码来源:secure.py

示例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))
开发者ID:serversetup,项目名称:SetupServer,代码行数:9,代码来源:site_functions.py

示例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))
开发者ID:serversetup,项目名称:SetupServer,代码行数:29,代码来源:git.py

示例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")
开发者ID:harshiljethava,项目名称:TestingSimpleSetupServer,代码行数:27,代码来源:apt_repo.py

示例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))
开发者ID:harshiljethava,项目名称:TestingSimpleSetupServer,代码行数:27,代码来源:services.py

示例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
开发者ID:harshiljethava,项目名称:TestingSimpleSetupServer,代码行数:11,代码来源:shellexec.py

示例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
开发者ID:harshiljethava,项目名称:TestingSimpleSetupServer,代码行数:12,代码来源:mysql.py

示例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")
开发者ID:serversetup,项目名称:SetupServer,代码行数:12,代码来源:aptget.py

示例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")
开发者ID:harshiljethava,项目名称:TestingSimpleSetupServer,代码行数:12,代码来源:fileutils.py

示例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")
开发者ID:harshiljethava,项目名称:TestingSimpleSetupServer,代码行数:12,代码来源:sitedb.py

示例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")
开发者ID:harshiljethava,项目名称:TestingSimpleSetupServer,代码行数:12,代码来源:sitedb.py

示例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.")
开发者ID:serversetup,项目名称:SetupServer,代码行数:13,代码来源:site_functions.py

示例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.")
开发者ID:harshiljethava,项目名称:TestingSimpleSetupServer,代码行数:56,代码来源:sitedb.py

示例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))
开发者ID:harshiljethava,项目名称:TestingSimpleSetupServer,代码行数:14,代码来源:fileutils.py


注:本文中的sss.core.logging.Log.debug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。