Passing calling commands with subprocess.

This commit is contained in:
Emiliano Vavassori 2015-09-30 00:33:03 +02:00
parent 1daca5d9f5
commit beb0312c68
3 changed files with 6 additions and 3 deletions
local.yml
roles
init/tasks
prereq/templates

@ -5,6 +5,7 @@
vars_files: vars_files:
- domainpwd.vault - domainpwd.vault
roles: roles:
- checkver
- init - init
- base - base
- custom - custom

@ -1,5 +1,6 @@
--- ---
- include: init.yml - include: init.yml
when: live_repover != ansible_local.checksum.repover
tags: tags:
- init - init

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
from os import popen from subprocess import Popen, PIPE, STDOUT
from os.path import isfile from os.path import isfile
from json import dumps, loads from json import dumps, loads
from hashlib import md5 from hashlib import md5
@ -15,8 +15,9 @@ local_repo_hash = ''
live_repo_hash = '' live_repo_hash = ''
# Getting live versions for repo # Getting live versions for repo
repover = popen("pushd %s >/dev/null; git log --pretty=oneline -1 | cut -d' ' -f 1; popd > /dev/null" % repo_path) p = Popen("pushd %s >/dev/null; git log --pretty=oneline -1 | cut -d' ' -f 1; popd > /dev/null" % repo_path, shell=True, stdout=PIPE, stderr=STDOUT)
live_repo_hash = repover.read().strip() output = p.communicate()[0]
live_repo_hash = output.strip()
repover.close() repover.close()
live_pkg_hash = '' live_pkg_hash = ''