specifies creation of directory if !exists

- added try catch for creation of directory, in case of an invalid path specified
- added specification to documentation
reviewable/pr18780/r1
Phil Schwartz 10 years ago
parent a21e23846d
commit fd12a5cc84

@ -41,7 +41,12 @@ If (-Not($params.dest -eq $null)) {
$dest = $params.dest.toString()
If (-Not (Test-Path $dest -PathType Container)){
New-Item -itemtype directory -path $dest
Try{
New-Item -itemtype directory -path $dest
}
Catch {
Fail-Json $result "Error creating $dest directory"
}
}
}
Else {

@ -27,7 +27,7 @@ module: win_unzip
version_added: ""
short_description: Unzips compressed files on the Windows node
description:
- Unzips compressed files, and can force reboot (if needed, i.e. such as hotfixes).
- Unzips compressed files, and can force reboot (if needed, i.e. such as hotfixes). If the destination directory does not exist, it will be created before unzipping the file. Specifying rm parameter will allow removal of the zip file after extraction.
options:
zip:
description:
@ -37,7 +37,7 @@ options:
aliases: []
dest:
description:
- Destination of zip file (provide absolute path of directory)
- Destination of zip file (provide absolute path of directory). If it does not exist, the directory will be created.
required: true
default: null
aliases: []

Loading…
Cancel
Save