mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 14:27:42 -02:30
Updates to insights playbook project syncing based on feedback
* Support "name" if given, else use a more reasonable file name for the playbook file * Fix an issue where we wouldn't populate the playbooks correctly in the database * Force downloading the playbooks every time since we can't tell when the file might change
This commit is contained in:
@@ -1318,10 +1318,10 @@ class RunProjectUpdate(BaseTask):
|
|||||||
lines = fd.readlines()
|
lines = fd.readlines()
|
||||||
if lines:
|
if lines:
|
||||||
p.scm_revision = lines[0].strip()
|
p.scm_revision = lines[0].strip()
|
||||||
p.playbook_files = p.playbooks
|
|
||||||
p.save()
|
|
||||||
else:
|
else:
|
||||||
logger.error("Could not find scm revision in check")
|
logger.info("Could not find scm revision in check")
|
||||||
|
p.playbook_files = p.playbooks
|
||||||
|
p.save()
|
||||||
try:
|
try:
|
||||||
os.remove(self.revision_path)
|
os.remove(self.revision_path)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
|
|
||||||
- name: update project using insights
|
- name: update project using insights
|
||||||
uri:
|
uri:
|
||||||
url: "{{insights_url}}/r/insights/v1/maintenance"
|
url: "{{insights_url}}/r/insights/v1/maintenance?ansible=true"
|
||||||
user: "{{scm_username|quote}}"
|
user: "{{scm_username|quote}}"
|
||||||
password: "{{scm_password|quote}}"
|
password: "{{scm_password|quote}}"
|
||||||
force_basic_auth: yes
|
force_basic_auth: yes
|
||||||
@@ -120,14 +120,27 @@
|
|||||||
state: directory
|
state: directory
|
||||||
when: scm_type == 'insights'
|
when: scm_type == 'insights'
|
||||||
|
|
||||||
- name: Fetch Insights Playbook
|
- name: Fetch Insights Playbook With Name
|
||||||
get_url:
|
get_url:
|
||||||
url: "{{insights_url}}/r/insights/v3/maintenance/{{item.maintenance_id}}/playbook"
|
url: "{{insights_url}}/r/insights/v3/maintenance/{{item.maintenance_id}}/playbook"
|
||||||
dest: "{{project_path|quote}}/{{item.maintenance_id}}.yml"
|
dest: "{{project_path|quote}}/{{item.name}}-{{item.maintenance_id}}.yml"
|
||||||
url_username: "{{scm_username|quote}}"
|
url_username: "{{scm_username|quote}}"
|
||||||
url_password: "{{scm_password|quote}}"
|
url_password: "{{scm_password|quote}}"
|
||||||
force_basic_auth: yes
|
force_basic_auth: yes
|
||||||
when: scm_type == 'insights'
|
force: yes
|
||||||
|
when: scm_type == 'insights' and item.name != None
|
||||||
|
with_items: "{{insights_output.json}}"
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: Fetch Insights Playbook
|
||||||
|
get_url:
|
||||||
|
url: "{{insights_url}}/r/insights/v3/maintenance/{{item.maintenance_id}}/playbook"
|
||||||
|
dest: "{{project_path|quote}}/insights-plan-{{item.maintenance_id}}.yml"
|
||||||
|
url_username: "{{scm_username|quote}}"
|
||||||
|
url_password: "{{scm_password|quote}}"
|
||||||
|
force_basic_auth: yes
|
||||||
|
force: yes
|
||||||
|
when: scm_type == 'insights' and item.name == None
|
||||||
with_items: "{{insights_output.json}}"
|
with_items: "{{insights_output.json}}"
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user