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
93cc08e6
Commit
93cc08e6
authored
Apr 27, 2015
by
root
Committed by
James Cammarata
Apr 27, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applying
bf916fb5
fix to v2
parent
805e83d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
v2/ansible/module_utils/powershell.ps1
+22
-0
No files found.
v2/ansible/module_utils/powershell.ps1
View file @
93cc08e6
...
...
@@ -142,3 +142,25 @@ Function ConvertTo-Bool
return
}
# Helper function to calculate md5 of a file in a way which powershell 3
# and above can handle:
Function
Get-FileMd5
(
$path
)
{
$hash
=
""
If
(
Test-Path
-PathType Leaf
$path
)
{
$sp
=
new-object
-TypeName System.Security.Cryptography.MD5CryptoServiceProvider;
$fp
=
[
System.IO.File]::Open
(
$path
,
[
System.IO.Filemode]::Open,
[
System.IO.FileAccess]::Read
)
;
[
System.BitConverter]::ToString
(
$sp
.ComputeHash
(
$fp
))
.Replace
(
"-"
,
""
)
.ToLower
()
;
$fp
.Dispose
()
;
}
ElseIf
(
Test-Path
-PathType Container
$path
)
{
$hash
=
"3"
;
}
Else
{
$hash
=
"1"
;
}
return
$hash
}
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