mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
async: use async_dir for the async results file directory (#45461)
* win async: use async_dir for the async results file directory * tried to unify POSIX and PowerShell async implementations of async_dir * fix sanity issue
This commit is contained in:
parent
60979a96a9
commit
5c73d4f4bd
11 changed files with 269 additions and 19 deletions
|
@ -51,12 +51,13 @@ def main():
|
|||
module = AnsibleModule(argument_spec=dict(
|
||||
jid=dict(required=True),
|
||||
mode=dict(default='status', choices=['status', 'cleanup']),
|
||||
# passed in from the async_status action plugin
|
||||
_async_dir=dict(required=True, type='path'),
|
||||
))
|
||||
|
||||
mode = module.params['mode']
|
||||
jid = module.params['jid']
|
||||
|
||||
async_dir = os.environ.get('ANSIBLE_ASYNC_DIR', '~/.ansible_async')
|
||||
async_dir = module.params['_async_dir']
|
||||
|
||||
# setup logging directory
|
||||
logdir = os.path.expanduser(async_dir)
|
||||
|
|
|
@ -9,13 +9,15 @@ $results = @{changed=$false}
|
|||
$parsed_args = Parse-Args $args
|
||||
$jid = Get-AnsibleParam $parsed_args "jid" -failifempty $true -resultobj $results
|
||||
$mode = Get-AnsibleParam $parsed_args "mode" -Default "status" -ValidateSet "status","cleanup"
|
||||
$_remote_tmp = Get-AnsibleParam $parsed_args "_ansible_remote_tmp" -type "path" -default $env:TMP
|
||||
|
||||
$log_path = [System.IO.Path]::Combine($_remote_tmp, ".ansible_async", $jid)
|
||||
# parsed in from the async_status action plugin
|
||||
$async_dir = Get-AnsibleParam $parsed_args "_async_dir" -type "path" -failifempty $true
|
||||
|
||||
$log_path = [System.IO.Path]::Combine($async_dir, $jid)
|
||||
|
||||
If(-not $(Test-Path $log_path))
|
||||
{
|
||||
Fail-Json @{ansible_job_id=$jid; started=1; finished=1} "could not find job"
|
||||
Fail-Json @{ansible_job_id=$jid; started=1; finished=1} "could not find job at '$async_dir'"
|
||||
}
|
||||
|
||||
If($mode -eq "cleanup") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue