Python __main__.display.debug() Examples
The following are 5
code examples of __main__.display.debug().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
__main__.display
, or try the search function
.
Example #1
Source File: Example4.LookUpPlugin.py From Implementing-DevOps-with-Ansible-2 with MIT License | 6 votes |
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)
Example #2
Source File: sshjail.py From ansible-sshjail with MIT License | 6 votes |
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)
Example #3
Source File: bitwarden.py From ansible-modules-bitwarden with GNU General Public License v3.0 | 6 votes |
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()
Example #4
Source File: gethostbyname.py From satellite-demo with MIT License | 5 votes |
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
Example #5
Source File: arubaoscx_rest.py From aruba-ansible-modules with Apache License 2.0 | 5 votes |
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