Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
8f549e11
Commit
8f549e11
authored
Jul 31, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'winrm_v2_fixes' of
https://github.com/cchurch/ansible
into cchurch-winrm_v2_fixes
parents
2a93559f
b07f8e7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
13 deletions
+22
-13
lib/ansible/module_utils/powershell.ps1
+22
-13
No files found.
lib/ansible/module_utils/powershell.ps1
View file @
8f549e11
...
@@ -35,19 +35,6 @@ $complex_args = @'
...
@@ -35,19 +35,6 @@ $complex_args = @'
Set-Content
env:MODULE_COMPLEX_ARGS -Value
$complex_args
Set-Content
env:MODULE_COMPLEX_ARGS -Value
$complex_args
$args
=
@
(
'env:MODULE_COMPLEX_ARGS'
)
$args
=
@
(
'env:MODULE_COMPLEX_ARGS'
)
# Helper function to parse Ansible JSON arguments from a "file" passed as
# the single argument to the module.
# Example: $params = Parse-Args $args
Function
Parse-Args
(
$arguments
)
{
$parameters
=
New-Object
psobject;
If
(
$arguments
.Length -gt 0
)
{
$parameters
=
Get-Content
$arguments
[
0] |
ConvertFrom-Json
;
}
$parameters
;
}
# Helper function to set an "attribute" on a psobject instance in powershell.
# Helper function to set an "attribute" on a psobject instance in powershell.
# This is a convenience to make adding Members to the object easier and
# This is a convenience to make adding Members to the object easier and
# slightly more pythonic
# slightly more pythonic
...
@@ -151,6 +138,28 @@ Function ConvertTo-Bool
...
@@ -151,6 +138,28 @@ Function ConvertTo-Bool
return
return
}
}
# Helper function to parse Ansible JSON arguments from a "file" passed as
# the single argument to the module.
# Example: $params = Parse-Args $args
Function
Parse-Args
(
$arguments
,
$supports_check_mode
=
$false
)
{
$parameters
=
New-Object
psobject
If
(
$arguments
.Length -gt 0
)
{
$parameters
=
Get-Content
$arguments
[
0] |
ConvertFrom-Json
}
$check_mode
=
Get-Attr
$parameters
"_ansible_check_mode"
$false
| ConvertTo-Bool
If
(
$check_mode
-and -not
$supports_check_mode
)
{
$obj
=
New-Object
psobject
Set
-Attr
$obj
"skipped"
$true
Set
-Attr
$obj
"changed"
$false
Set
-Attr
$obj
"msg"
"remote module does not support check mode"
Exit
-Json
$obj
}
$parameters
}
# Helper function to calculate a hash of a file in a way which powershell 3
# Helper function to calculate a hash of a file in a way which powershell 3
# and above can handle:
# and above can handle:
Function
Get-FileChecksum
(
$path
)
Function
Get-FileChecksum
(
$path
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment