1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 06:51:10 +03:00

Merge pull request #1417 from chrismeyersfsu/fix-config_watcher

invoke main() in config watcher script
This commit is contained in:
Chris Meyers 2018-03-01 17:11:58 -05:00 committed by GitHub
commit f907995374
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,9 @@ def write_hash(f, h):
def main():
settings_file = "/etc/tower/settings.py"
hash_file = "/var/lib/awx/.configsha"
while 1:
rpc = childutils.getRPCInterface(os.environ)
headers, payload = childutils.listener.wait(sys.stdin, sys.stdout)
@ -32,13 +35,13 @@ def main():
childutils.listener.ok(sys.stdout)
continue
try:
current_hash = hash("/etc/tower/settings.py")
current_hash = hash(settings_file)
except:
sys.stderr.write("Could not open settings.py, skipping config watcher")
childutils.listener.ok(sys.stdout)
continue
try:
if current_hash == last_hash("/var/lib/awx/.configsha"):
if current_hash == last_hash(hash_file):
childutils.listener.ok(sys.stdout)
continue
else:
@ -51,8 +54,11 @@ def main():
sys.stderr.write('Restarting %s\n' % program)
rpc.supervisor.stopProcess(program)
rpc.supervisor.startProcess(program)
except:
sys.stderr.write("No previous hash found")
write_hash("/var/lib/awx/.configsha")
write_hash(hash_file, current_hash)
childutils.listener.ok(sys.stdout)
if __name__ == '__main__':
main()