Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packages don't handle array list correctly passed via parameter #1

Open
fvanroie opened this issue Jan 18, 2018 · 1 comment
Open
Assignees

Comments

@fvanroie
Copy link
Owner

fvanroie commented Jan 18, 2018

Passing multiple packagenames to Install/Remove package cmdlet doesn't work correctly. Arrays need to be tested/verified to work correctly.

@fvanroie fvanroie self-assigned this Jan 18, 2018
@hinchbitz
Copy link

Greetings - your project is an excellent idea and could be very useful for Powershell users,

I'm experiencing the following issue when attempting to create an object for New-OPNsenseHAProxyServer

Example from documentation:
$webservers = 1..3 | foreach-Object {
[OPNsense.HAProxy.Servers.Server]@{
'name' = ("web" + $.tostring("000"))
'address' = "192.168.0.$
"
'port' = '80'
'description' = "Created {0}" -f [DateTime]::now
'mode' = 'active'
}
}
$webservers = $webservers | New-OPNsenseHAProxyServer -Verbose:$beVerbose

I have an array $realServers containing two example servers with additional items for ssl, sslCA, sslVerify:

$realServers

name : server1.example
address : 192.168.0.1
port : 443
mode : active
ssl : TRUE
sslCA : MyCA
sslVerify : TRUE

name : server2.example
address : 192.168.0.2
port : 443
mode : active
ssl : TRUE
sslCA : MyCA
sslVerify : TRUE

I pipe my array to a modified version of the example:

$webservers = $realServers | foreach-Object {
$sslEnabled = $false
$sslVerify = $false
if ($.ssl -eq "TRUE") {$sslEnabled = $true}
if ($
.sslVerify -eq "TRUE") {$sslVerify = $true}
[OPNsense.HAProxy.Servers.Server]@{
'name' = $.name
'address' = $
.address
'port' = $.port
'description' = $
.name+" ("+$.address+")"
'mode' = $
.mode
'ssl' = $sslEnabled
'sslCA' = $_.sslCA
'sslVerify' = $sslVerify
}
}

But the output does not include the additional items requested (mode, ssl, sslCA, sslVerify are missing):

$webservers

Address Description Name Port Uuid


192.168.0.1 server1.example (192.168.0.1) server1.example 443
192.168.0.2 server2.example (192.168.0.2) server2.example 443

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants