mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 15:58:45 -03:30
Merge pull request #5213 from AlanCoding/dry_run
Surface dry_run option for system jobs through the API
This commit is contained in:
@@ -8,16 +8,20 @@ on the host system via the `tower-manage` command.
|
|||||||
|
|
||||||
For example on `cleanup_jobs` and `cleanup_activitystream`:
|
For example on `cleanup_jobs` and `cleanup_activitystream`:
|
||||||
|
|
||||||
`{"days": 30}`
|
`{"extra_vars": {"days": 30}}`
|
||||||
|
|
||||||
Which will act on data older than 30 days.
|
Which will act on data older than 30 days.
|
||||||
|
|
||||||
For `cleanup_facts`:
|
For `cleanup_facts`:
|
||||||
|
|
||||||
`{"older_than": "4w", "granularity": "3d"}`
|
`{"extra_vars": {"older_than": "4w", "granularity": "3d"}}`
|
||||||
|
|
||||||
Which will reduce the granularity of scan data to one scan per 3 days when the data is older than 4w.
|
Which will reduce the granularity of scan data to one scan per 3 days when the data is older than 4w.
|
||||||
|
|
||||||
|
For `cleanup_activitystream` and `cleanup_jobs` commands, providing
|
||||||
|
`"dry_run": true` inside of `extra_vars` will show items that will be
|
||||||
|
removed without deleting them.
|
||||||
|
|
||||||
Each individual system job task has its own default values, which are
|
Each individual system job task has its own default values, which are
|
||||||
applicable either when running it from the command line or launching its
|
applicable either when running it from the command line or launching its
|
||||||
system job template with empty `extra_vars`.
|
system job template with empty `extra_vars`.
|
||||||
|
|||||||
@@ -1914,6 +1914,8 @@ class RunSystemJob(BaseTask):
|
|||||||
json_vars = json.loads(system_job.extra_vars)
|
json_vars = json.loads(system_job.extra_vars)
|
||||||
if 'days' in json_vars and system_job.job_type != 'cleanup_facts':
|
if 'days' in json_vars and system_job.job_type != 'cleanup_facts':
|
||||||
args.extend(['--days', str(json_vars.get('days', 60))])
|
args.extend(['--days', str(json_vars.get('days', 60))])
|
||||||
|
if 'dry_run' in json_vars and json_vars['dry_run'] and system_job.job_type != 'cleanup_facts':
|
||||||
|
args.extend(['--dry-run'])
|
||||||
if system_job.job_type == 'cleanup_jobs':
|
if system_job.job_type == 'cleanup_jobs':
|
||||||
args.extend(['--jobs', '--project-updates', '--inventory-updates',
|
args.extend(['--jobs', '--project-updates', '--inventory-updates',
|
||||||
'--management-jobs', '--ad-hoc-commands', '--workflow-jobs',
|
'--management-jobs', '--ad-hoc-commands', '--workflow-jobs',
|
||||||
|
|||||||
Reference in New Issue
Block a user