Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Standalone Hosts... #212

Open
rockaut opened this issue Jun 26, 2018 · 1 comment
Open

Standalone Hosts... #212

rockaut opened this issue Jun 26, 2018 · 1 comment

Comments

@rockaut
Copy link
Contributor

rockaut commented Jun 26, 2018

Currently no "standalone" hosts can't be scanned as in "VesterTemplate.Tests.ps1" around line 41 there is
'Host' {$Datacenter | Get-Cluster -Name $cfg.scope.cluster | Get-VMHost -Name $cfg.scope.host}

Expected Behavior

Also scan standalone hosts any way provided - in devinitive scope or with wildcard.

Current Behavior

Completely ignores any host outside clusters

Possible Solution

I tried to just remove Get-Cluster -Name $cfg.scope.cluster | but than you can't filter on just on cluster as all hosts are returned.

@rockaut
Copy link
Contributor Author

rockaut commented Jun 26, 2018

I came up with that:

'Host' { if( $cfg.scope.cluster -ne "*" -and $cfg.scope.host -eq "*" ) { $Datacenter | Get-Cluster -Name $cfg.scope.cluster | Get-VMHost -Name $cfg.scope.host } elseif( $cfg.scope.cluster -ne "*" -and $cfg.scope.host -ne "*" ) { $Datacenter | Get-Cluster -Name $cfg.scope.cluster | Get-VMHost -Name $cfg.scope.host } else { $Datacenter | Get-VMHost -Name $cfg.scope.host } }

  • If cluster is filtered and host is wildcard = return cluster hosts
  • if cluster is filtered and host is filtered = try to return host ( if host not in cluster it's empty )
  • if cluster is unfiltered = try to return host ( if host not found it's empty )

I may provide an PR but first wanted to see communities thoughts.

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

No branches or pull requests

1 participant