specifies creation of directory if !exists
- added try catch for creation of directory, in case of an invalid path specified - added specification to documentation
This commit is contained in:
parent
a21e23846d
commit
fd12a5cc84
2 changed files with 8 additions and 3 deletions
|
@ -41,7 +41,12 @@ If (-Not($params.dest -eq $null)) {
|
||||||
$dest = $params.dest.toString()
|
$dest = $params.dest.toString()
|
||||||
|
|
||||||
If (-Not (Test-Path $dest -PathType Container)){
|
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 {
|
Else {
|
||||||
|
|
|
@ -27,7 +27,7 @@ module: win_unzip
|
||||||
version_added: ""
|
version_added: ""
|
||||||
short_description: Unzips compressed files on the Windows node
|
short_description: Unzips compressed files on the Windows node
|
||||||
description:
|
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:
|
options:
|
||||||
zip:
|
zip:
|
||||||
description:
|
description:
|
||||||
|
@ -37,7 +37,7 @@ options:
|
||||||
aliases: []
|
aliases: []
|
||||||
dest:
|
dest:
|
||||||
description:
|
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
|
required: true
|
||||||
default: null
|
default: null
|
||||||
aliases: []
|
aliases: []
|
||||||
|
|
Loading…
Reference in a new issue