Skip to content

Commit

Permalink
update - fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
superstes committed Oct 27, 2021
1 parent 0dcfc79 commit 4fdb47c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion code/update/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _execute(self):
)

results.append(self._process(
cmd=f"cd {path_ansible} && ansible-playbook -K -i inventories/hosts.yml setup.yml --limit localhost {vars_string}",
cmd=f"cd {path_ansible} && ansible-playbook update.yml {vars_string}",
msg="Starting ansible-playbook to update GrowAutomation!")
)

Expand Down
10 changes: 8 additions & 2 deletions code/web/base/ga/subviews/system/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def update_start(request, current_version):
f"ga_update_path_log={get_server_config(setting='path_log')}\n"
)

web_subprocess(f'sudo systemctl start {config.UPDATE_SERVICE}.service')
web_subprocess(f'sudo systemctl start {config.UPDATE_SERVICE}.service --no-block')
return redirect('/system/update/status/')

except KeyError as error:
Expand All @@ -111,9 +111,15 @@ def update_status_view(request):
if log_data[-3].find('Succeeded') != -1:
status = 'Finished successfully!'

elif log_data[2].find('failed') != -1 or log_data[-3].find('Failed') != -1:
elif log_data[2].find('failed') != -1:
status = 'Failed!'

else:
for line in log_data[-5:-2]:
if line.find('failed') != -1 or line.find('Failed') != -1:
status = 'Failed'
break

return render(request, 'system/update/status.html', context={
'request': request, 'title': 'System Update Status', 'log_data': log_data, 'reload_time': reload_time, 'status': status, 'redirect_time': redirect_time,
})
2 changes: 1 addition & 1 deletion setup/update.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

- name: Updating GrowAutomation
hosts: all
hosts: localhost
become: true
vars_files:
- './vars/main.yml'
Expand Down

0 comments on commit 4fdb47c

Please sign in to comment.