本文整理汇总了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