當前位置: 首頁>>代碼示例>>Python>>正文


Python display.debug方法代碼示例

本文整理匯總了Python中__main__.display.debug方法的典型用法代碼示例。如果您正苦於以下問題:Python display.debug方法的具體用法?Python display.debug怎麽用?Python display.debug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在__main__.display的用法示例。


在下文中一共展示了display.debug方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: from __main__ import display [as 別名]
# 或者: from __main__.display import debug [as 別名]
def run(self, terms, variables=None, **kwargs):

        ret = []
        # Perform iteration
        for term in terms:

            display.debug("File lookup term: %s" % term)

            # Find the file in the expected search path
            lookupfile = self.find_file_in_search_path(variables, 'files', term)
            display.vvvv(u"File lookup using %s as file" % lookupfile)
            try:
                if lookupfile:
                    contents, show_data = self._loader._get_file_contents(lookupfile)
                    ret.append(contents.rstrip())
                else:
                    raise AnsibleParserError()

            except AnsibleParserError:
                raise AnsibleError("could not locate file in lookup: %s" % term) 
開發者ID:PacktPublishing,項目名稱:Implementing-DevOps-with-Ansible-2,代碼行數:22,代碼來源:Example4.LookUpPlugin.py

示例2: exec_command

# 需要導入模塊: from __main__ import display [as 別名]
# 或者: from __main__.display import debug [as 別名]
def exec_command(self, cmd, in_data=None, executable='/bin/sh', sudoable=True):
        ''' run a command in the jail '''
        slpcmd = False

        if '&& sleep 0' in cmd:
            slpcmd = True
            cmd = self._strip_sleep(cmd)

        if 'sudo' in cmd:
            cmd = self._strip_sudo(executable, cmd)

        cmd = ' '.join([executable, '-c', pipes.quote(cmd)])
        if slpcmd:
            cmd = '%s %s %s %s' % (self.get_jail_connector(), self.get_jail_id(), cmd, '&& sleep 0')
        else:
            cmd = '%s %s %s' % (self.get_jail_connector(), self.get_jail_id(), cmd)

        if self._play_context.become:
            # display.debug("_low_level_execute_command(): using become for this command")
            cmd = self._play_context.make_become_cmd(cmd)

        # display.vvv("JAIL (%s) %s" % (local_cmd), host=self.host)
        return super(Connection, self).exec_command(cmd, in_data, True) 
開發者ID:austinhyde,項目名稱:ansible-sshjail,代碼行數:25,代碼來源:sshjail.py

示例3: _run

# 需要導入模塊: from __main__ import display [as 別名]
# 或者: from __main__.display import debug [as 別名]
def _run(self, args):
        p = Popen([self.cli_path] + args, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
        out, _ = p.communicate()
        out = out.decode()
        rc = p.wait()
        if rc != 0:
            display.debug("Received error when running '{0} {1}': {2}"
                          .format(self.cli_path, args, out))
            if out.startswith("Vault is locked."):
                raise AnsibleError("Error accessing Bitwarden vault. "
                                   "Run 'bw unlock' to unlock the vault.")
            elif out.startswith("You are not logged in."):
                raise AnsibleError("Error accessing Bitwarden vault. "
                                   "Run 'bw login' to login.")
            elif out.startswith("Failed to decrypt."):
                raise AnsibleError("Error accessing Bitwarden vault. "
                                   "Make sure BW_SESSION is set properly.")
            elif out.startswith("Not found."):
                raise AnsibleError("Error accessing Bitwarden vault. "
                        "Specified item not found: {}".format(args[-1]))
            else:
                raise AnsibleError("Unknown failure in 'bw' command: "
                                   "{0}".format(out))
        return out.strip() 
開發者ID:c0sco,項目名稱:ansible-modules-bitwarden,代碼行數:26,代碼來源:bitwarden.py

示例4: run

# 需要導入模塊: from __main__ import display [as 別名]
# 或者: from __main__.display import debug [as 別名]
def run(self, terms, variables=None, **kwargs):

        ret = []

        for term in terms:
            display.debug("gethostbyname: %s" % term)

            try:
                ret.append(gethostbyname(term))
            except Exception as e:
                raise AnsibleError("Unable to lookup '{}': {}".format(term, e))

        return ret 
開發者ID:RedHatSatellite,項目名稱:satellite-demo,代碼行數:15,代碼來源:gethostbyname.py

示例5: close

# 需要導入模塊: from __main__ import display [as 別名]
# 或者: from __main__.display import debug [as 別名]
def close(self):
        if self._connected:
            response = self._http_session_handle.post(self._logout_url, verify=False)
            display.debug("Hi! Closing the http connection now")
            display.vvvv(response.text)
            display.display("Closed the http connection!")
            self._connected = False 
開發者ID:aruba,項目名稱:aruba-ansible-modules,代碼行數:9,代碼來源:arubaoscx_rest.py


注:本文中的__main__.display.debug方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。