Skip to content
This repository was archived by the owner on Jul 28, 2020. It is now read-only.

CFDEV fail to start on Windows with conflicting Powershell modules installed #111

Closed
shouah opened this issue Aug 20, 2019 · 2 comments
Closed

Comments

@shouah
Copy link

shouah commented Aug 20, 2019

Summary:
When running CFDEV on Windows 10 which has powershell modules for both Hyper-V and VMware PowerCLI installed, which has duplicated commands like Get-VM, then then CF CLI plugin invokes the wrong command and fails unexpectedly.

Expected behavior:
The command "cf dev start -f ...tgz" invokes the correct PowerShell commands under the hood

Observed behavior:

> cf dev start -f .\pcfdev-v1.2.0-windows.tgz
FAILED
cf dev start: is running: getting vms: failed to execute: powershell.exe -Command "Get-VM -Name cfdev*": exit status 1: Get-VM : 8/20/2019 10:33:14 AMGet-VM          You are not currently connected to any servers. Please connect first using a Connect cmdlet.
At line:1 char:1
+ Get-VM -Name cfdev*
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-VM], ViServerConnectionException
    + FullyQualifiedErrorId : Core_BaseCmdlet_NotConnectedError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

Request:
Either:

  1. Update the plugin to explicitly prefix all PowerShell commands with the Hyper-V prefix to ensure ambiguous execution, for example:

powershell.exe -Command "Hyper-V\Get-VM -Name cfdev*"

  1. Or provide a start command line option to specify the PowerShell prefix to be used, something like:

cf dev start -f ...tgz -psprefix "Hyper-V"

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/168005551

The labels on this github issue will be updated when the story is started.

aemengo pushed a commit that referenced this issue Aug 23, 2019
Helps in cases where Powershell Modules with conflicting names are
installed.

Issue brought up by @shouah in:
#111
aemengo pushed a commit that referenced this issue Aug 23, 2019
Helps in cases where Powershell Modules with conflicting names are
installed.

Issue brought up by @shouah in:
#111
@aemengo
Copy link
Contributor

aemengo commented Sep 5, 2019

Apologies for the lack of response on this issue, up until now. Your request is sound and is a use-case that we'd like to support. We opted for option 1.

  1. Update the plugin to explicitly prefix all PowerShell commands with the Hyper-V prefix to ensure ambiguous execution

The code fix should be applied and present in our most recent CLI release: 0.0.17.

$ cf install-plugin -r CF-Community cfdev
...
$ cf dev version
CLI: 0.0.17
BUILD: 14 (b36c82e)

Many thanks for bringing this to our attention.

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

3 participants