plain = None is_encrypted = False found = False gpg_block = False for line in logs.splitlines(): if gpg_block: encrypted.append(line) if line == '-----END PGP MESSAGE-----': gpg_block = False is_encrypted = True found = True elif line.endswith('FiWare Support:'): gpg_block = True encrypted = list() elif line.startswith('support:') or line.startswith('Fiware Support: '): password = line.partition(':')[2].strip() found = True is_encrypted = False if is_encrypted: encrypted = '\n'.join(encrypted) print encrypted output = Popen(['gpg', '-d'], stdin=PIPE, stdout=PIPE, stderr=PIPE).communicate(encrypted)[0] print output.partition(':')[2].strip(), elif found: print password, print server.get_vnc_console('novnc')['console']['url']
def svn_get_version(): from subprocess import Popen, PIPE output = Popen(["svn", "info", "mealadvisor"], stdout=PIPE).communicate()[0] return output.partition('Revision: ')[2].partition('\n')[0]
plain = None is_encrypted = False found = False gpg_block = False for line in logs.splitlines(): if gpg_block: encrypted.append(line) if line == '-----END PGP MESSAGE-----': gpg_block = False is_encrypted = True found = True elif line.endswith('FiWare Support:'): gpg_block = True encrypted = list() elif line.startswith('support:') or line.startswith('Fiware Support: '): password = line.partition(':')[2].strip() found = True is_encrypted = False if is_encrypted: encrypted = '\n'.join(encrypted) print(encrypted) output = Popen(['gpg', '-d'], stdin=PIPE, stdout=PIPE, stderr=PIPE).communicate(encrypted)[0] print(output.partition(':')[2].strip()) elif found: print(password) print(server.get_vnc_console('novnc')['console']['url'])