Skip to content

Commit

Permalink
update to 0.5.2.4.
Browse files Browse the repository at this point in the history
Fix Watch-ValentiapingAsyncReplyStatus
  • Loading branch information
guitarrapc committed Feb 2, 2016
1 parent b2f89a4 commit a37d68b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Watch-ValentiaPingAsyncReplyStatus
[ValidateNotNullOrEmpty()]
[string[]]$deploygroups,

[parameter(mandatory = $true, position = 1)]
[parameter(mandatory = $false, position = 1)]
[ValidateNotNullOrEmpty()]
[bool]$DesiredStatus = $true,

Expand All @@ -45,37 +45,45 @@ function Watch-ValentiaPingAsyncReplyStatus
[int]$limitCount = 100
)

begin
{
$start = Get-Date
$sw = New-Object System.Diagnostics.Stopwatch
$sw.Start()

$ipaddress = New-Object 'System.Collections.Generic.List[IPAddress]'
Get-ValentiaGroup -DeployGroups $deploygroups | %{$ipaddress.Add($_)}
}

process
{
$i = 0
while ($true)
{
$date = Get-Date
$hash = pingAsync -HostNameOrAddresses $ipaddress `
| %{
Add-Member -InputObject $_ -MemberType NoteProperty -Name Date -Value $date -Force -PassThru
}
$hash = Ping-ValentiaGroupAsync -HostNameOrAddresses $ipaddress `
| %{ Add-Member -InputObject $_ -MemberType NoteProperty -Name Date -Value ([DateTime]::Now) -Force -PassThru }

Write-Verbose ("Filtering status as '{0}'" -f $DesiredStatus)
$hash `
| where IsSuccess -eq $DesiredStatus `
| where HostNameOrAddress -in $ipaddress.IPAddressToString `
| %{$result = $ipaddress.Remove($_.HostNameOrAddress)
| where IPAddress -in $ipaddress.IPAddressToString `
| %{
$result = $ipaddress.Remove($_.IPAddress)
if ($result -eq $false)
{
throw "failed to remove ipaddress '{0}' from list" -f $_.HostNameOrAddress
throw "failed to remove ipaddress '{0}' from list" -f $_.IPAddress
}
else
{
Write-Host ("ipaddress '{0}' turned to be DesiredStatus '{1}'" -f "$($_.HostNameOrAddress -join ', ')", $DesiredStatus) -ForegroundColor Green
Write-Host ("ipaddress '{0}' turned to be DesiredStatus '{1}'" -f "$($_.IPAddress -join ', ')", $DesiredStatus) -ForegroundColor Green
}
}

$count = ($ipaddress | measure).count

if ($count -eq 0)
{
Write-Host ("HostnameOrAddress '{0}' IsSuccess : '{1}'. break monitoring" -f $($hash.HostNameOrAddress -join ", "), $DesiredStatus) -ForegroundColor Cyan
Write-Host ("HostnameOrAddress '{0}' IsSuccess : '{1}'. break monitoring" -f $($hash.IPAddress -join ", "), $DesiredStatus) -ForegroundColor Cyan
$hash
break;
}
Expand All @@ -102,14 +110,4 @@ function Watch-ValentiaPingAsyncReplyStatus
Write-Host ("End Time : {0}" -f $end) -ForegroundColor Cyan
Write-Host ("Total Watch : {0}sec" -f $sw.Elapsed.TotalSeconds) -ForegroundColor Cyan
}

begin
{
$start = Get-Date
$sw = New-Object System.Diagnostics.Stopwatch
$sw.Start()

$ipaddress = New-Object 'System.Collections.Generic.List[ipaddress]'
Get-ValentiaGroup -DeployGroups $deploygroups | %{$ipaddress.Add($_)}
}
}
2 changes: 1 addition & 1 deletion valentia/Tools/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $valentia.combineTempfunction = '{0}.ps1' -f $valentia.name
$valentia.combineTemptype = 'Type.ps1'
$valentia.fileEncode = [Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding]'utf8'

$valentia.moduleVersion = "0.5.2.3"
$valentia.moduleVersion = "0.5.2.4"
$valentia.description = "PowerShell Remote deployment library for Windows Servers";
$valentia.copyright = "28/June/2013 -"
$valentia.RequiredModules = @()
Expand Down
40 changes: 19 additions & 21 deletions valentia/valentia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8604,7 +8604,7 @@ function Watch-ValentiaPingAsyncReplyStatus
[ValidateNotNullOrEmpty()]
[string[]]$deploygroups,

[parameter(mandatory = $true, position = 1)]
[parameter(mandatory = $false, position = 1)]
[ValidateNotNullOrEmpty()]
[bool]$DesiredStatus = $true,

Expand All @@ -8617,37 +8617,45 @@ function Watch-ValentiaPingAsyncReplyStatus
[int]$limitCount = 100
)

begin
{
$start = Get-Date
$sw = New-Object System.Diagnostics.Stopwatch
$sw.Start()

$ipaddress = New-Object 'System.Collections.Generic.List[IPAddress]'
Get-ValentiaGroup -DeployGroups $deploygroups | %{$ipaddress.Add($_)}
}

process
{
$i = 0
while ($true)
{
$date = Get-Date
$hash = pingAsync -HostNameOrAddresses $ipaddress `
| %{
Add-Member -InputObject $_ -MemberType NoteProperty -Name Date -Value $date -Force -PassThru
}
$hash = Ping-ValentiaGroupAsync -HostNameOrAddresses $ipaddress `
| %{ Add-Member -InputObject $_ -MemberType NoteProperty -Name Date -Value ([DateTime]::Now) -Force -PassThru }

Write-Verbose ("Filtering status as '{0}'" -f $DesiredStatus)
$hash `
| where IsSuccess -eq $DesiredStatus `
| where HostNameOrAddress -in $ipaddress.IPAddressToString `
| %{$result = $ipaddress.Remove($_.HostNameOrAddress)
| where IPAddress -in $ipaddress.IPAddressToString `
| %{
$result = $ipaddress.Remove($_.IPAddress)
if ($result -eq $false)
{
throw "failed to remove ipaddress '{0}' from list" -f $_.HostNameOrAddress
throw "failed to remove ipaddress '{0}' from list" -f $_.IPAddress
}
else
{
Write-Host ("ipaddress '{0}' turned to be DesiredStatus '{1}'" -f "$($_.HostNameOrAddress -join ', ')", $DesiredStatus) -ForegroundColor Green
Write-Host ("ipaddress '{0}' turned to be DesiredStatus '{1}'" -f "$($_.IPAddress -join ', ')", $DesiredStatus) -ForegroundColor Green
}
}

$count = ($ipaddress | measure).count

if ($count -eq 0)
{
Write-Host ("HostnameOrAddress '{0}' IsSuccess : '{1}'. break monitoring" -f $($hash.HostNameOrAddress -join ", "), $DesiredStatus) -ForegroundColor Cyan
Write-Host ("HostnameOrAddress '{0}' IsSuccess : '{1}'. break monitoring" -f $($hash.IPAddress -join ", "), $DesiredStatus) -ForegroundColor Cyan
$hash
break;
}
Expand All @@ -8674,16 +8682,6 @@ function Watch-ValentiaPingAsyncReplyStatus
Write-Host ("End Time : {0}" -f $end) -ForegroundColor Cyan
Write-Host ("Total Watch : {0}sec" -f $sw.Elapsed.TotalSeconds) -ForegroundColor Cyan
}

begin
{
$start = Get-Date
$sw = New-Object System.Diagnostics.Stopwatch
$sw.Start()

$ipaddress = New-Object 'System.Collections.Generic.List[ipaddress]'
Get-ValentiaGroup -DeployGroups $deploygroups | %{$ipaddress.Add($_)}
}
}
# file loaded from path : \functions\Invokation\Ping\Watch-ValentiaPingAsyncReplyStatus.ps1

Expand Down
6 changes: 3 additions & 3 deletions valentia/valentia.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: guitarrapc
#
# Generated on: 1/22/2016
# Generated on: 2/3/2016
#

@{
Expand All @@ -12,10 +12,10 @@
# RootModule = ''

# Version number of this module.
ModuleVersion = '0.5.2.3'
ModuleVersion = '0.5.2.4'

# ID used to uniquely identify this module
GUID = '2e79e172-1295-44e9-bc1b-4593da0cbb33'
GUID = 'fcc6712d-05e1-479c-80fc-8c8292cb1e46'

# Author of this module
Author = 'guitarrapc'
Expand Down

0 comments on commit a37d68b

Please sign in to comment.