本文整理匯總了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)
示例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)
示例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()
示例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
示例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