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

External dependencies not consistently defined #194

Open
ghost opened this issue Oct 23, 2017 · 1 comment
Open

External dependencies not consistently defined #194

ghost opened this issue Oct 23, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 23, 2017

Dependencies on external, environmental (powershell) configuration is not consistently defined.

Expected Behavior

AS A user of the project
I WANT to have consistent method to identify module dependencies
SO THAT I can easily and quickly ensure my environment is configured correctly to use this module.

Current Behavior

Example from New-VesterConfig, lines 157 to 163:

    # Secondary modules...PowerCLI doesn't do implicit module loading as of PCLI 6.5
    # This is all the effort I'm willing to put into working around that right now
    Try {
        $Network = $Datacenter | Get-VDSwitch -Name $config.scope.vds -ErrorAction Stop
    } Catch {
        Write-Warning 'Get-VDSwitch failed. Have you manually imported module "VMware.VimAutomation.Vds"?'
    }

Possible Solution

In no particular order:

  • Update manifest file to include VMware.VimAutomation.Vds
  • Add in to root module a version check, if 6.5.1 or later is install, do nothing, otherwise Import-Module VMware.VimAutomation.Vds

After one or both of the above is implemented, remove try/catch fro New-VesterConfig.

Context

As a user, this has had no negative impact to me.
As a contributor this has added complexity when reading through the code.

Your Environment

  • Vester module version used: 1.2.0
  • PowerCLI version: 6.5.3
  • Pester version: 3.4.3
  • Operating System and PowerShell version: Win10, 5.1
@midacts
Copy link
Contributor

midacts commented Dec 24, 2017

Agreed.

I think that is a legacy issue (meaning that code existed prior to PowerCLI being on the PowerShell gallery).

I would recommend we remove lines of code like that
and
add 'VMware.PowerCLI' as an external module dependcy to the module manifest

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