Closed mcascone closed 4 years ago
I've just noticed that running a non-vra basic knife command fails too, with the same error:
> knife cookbook list
Traceback (most recent call last):
16: from C:/opscode/chef-workstation/bin/knife:370:in `<main>'
15: from C:/opscode/chef-workstation/bin/knife:370:in `load'
14: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/bin/knife:24:in `<top (required)>'
13: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/application/knife.rb:163:in `run'
12: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife.rb:224:in `run'
11: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife.rb:161:in `subcommand_class_from'
10: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:129:in `command_class_from'
9: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:115:in `load_command'
8: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `load_commands'
7: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `each'
6: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `block in load_commands'
5: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `load'
4: from C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:26:in `<top (required)>'
3: from C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:27:in `<class:Chef>'
2: from C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:28:in `<class:Knife>'
1: from C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:29:in `<class:Cloud>'
C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:30:in `<class:VraServerCreate>': uninitialized constant Chef::Knife::Cloud::VraServerCreate::VraServiceHelpers (NameError)
Did you mean? Chef::Knife::Cloud::VraServiceOptions
When I chef gem uninstall knife-vrealize
, knife commands work again.
@mcascone Please check if updating your GEM_PATH
& GEM_HOME
to C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
resolves this issue.
Interesting; I thought that's what chef shell-init powershell
does? What might cause mine to be set to my user appdata? I'll change and test and report.
FWIW the output of chef shell-init powershell
(without the | invoke-expression
) is:
> chef shell-init powershell
$env:PATH="C:/opscode/chef-workstation/bin;C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/bin;C:/opscode/chef-workstation/embedded/bin;C:/opscode/chef-workstation/bin;C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/bin;C:/opscode/chef-workstation/embedded/bin;C:\Program Files\PowerShell\7;C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\ConEmu;C:\Program Files\ConEmu\ConEmu;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\ProgramData\chocolatey\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\HashiCorp\Vagrant\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Google\Chrome\Application;C:\Program Files\PowerShell\7\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\dotnet\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\opscode\chef-workstation\bin\;C:\Users\mcascone1\AppData\Local\Microsoft\WindowsApps;c:\users\mcascone1\appdata\local\chefdk\gem\ruby\2.6.0\bin;C:\Users\mcascone1\AppData\Roaming\npm;C:\Users\mcascone1\.dotnet\tools;C:/opscode/chef-workstation/embedded/git/usr/bin;C:/opscode/chef-workstation/embedded/git/usr/bin"
$env:GEM_ROOT="C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0"
$env:GEM_HOME="C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0"
$env:GEM_PATH="C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0;C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0"
So i'll set gem_home
and gem_path
to gem_root
.
Update: after setting those vars and installing the gem, i still get the same errors. And it looks like it was still installed to the same place. I see the PATH warning there, but don't we not want the gems installed in our home dir? I am not as knowledgeable as I'd like to be in this area so please excuse if i am doing something dumb.
> $env:gem_path
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
> $env:gem_home
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
> chef gem install knife-vrealize
WARNING: You don't have c:\users\mcascone1\appdata\local\chefdk\gem\ruby\2.7.0\bin in your PATH,
gem executables will not run.
Successfully installed knife-vrealize-6.0.0
Parsing documentation for knife-vrealize-6.0.0
Installing ri documentation for knife-vrealize-6.0.0
Done installing documentation for knife-vrealize after 2 seconds
1 gem installed
> knife vra catalog list --entitled
Traceback (most recent call last):
16: from C:/opscode/chef-workstation/bin/knife:370:in `<main>'
15: from C:/opscode/chef-workstation/bin/knife:370:in `load'
14: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/bin/knife:24:in `<top (required)>'
13: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/application/knife.rb:163:in `run'
12: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife.rb:224:in `run'
11: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife.rb:161:in `subcommand_class_from'
10: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:129:in `command_class_from'
9: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:115:in `load_command'
8: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `load_commands'
7: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `each'
6: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `block in load_commands'
5: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `load'
4: from C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:26:in `<top (required)>'
3: from C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:27:in `<class:Chef>'
2: from C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:28:in `<class:Knife>'
1: from C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:29:in `<class:Cloud>'
C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:30:in `<class:VraServerCreate>': uninitialized constant Chef::Knife::Cloud::VraServerCreate::VraServiceHelpers (NameError)
Did you mean? Chef::Knife::Cloud::VraServiceOptions
~\Documents\github\Pipeline-ServicePasswordChange [develop ≡ +0 ~1 -0 !]
> $env:gem_path
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
~\Documents\github\Pipeline-ServicePasswordChange [develop ≡ +0 ~1 -0 !]
> $env:gem_root
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
~\Documents\github\Pipeline-ServicePasswordChange [develop ≡ +0 ~1 -0 !]
> $env:gem_home
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
I thought at first it was an issue between Powershell 5.1 and 7, but i've done everything i can think to do regarding those $env:gem_x
vars, and the gem is still getting installed to C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/
, and the knife call fails. To be clear I'm always using chef install gem knife-vrealize
. I'm out of ideas. Help?
Can you check removing this from PATH C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/bin
and keep GEM_PATH & GEM_HOME to C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
Errors you are getting is only due to incorrect path vars.
It's gotta be. So, i checked my PATH in the windows system properties control panel, and that path isn't in it.
I remembered that my $PROFILE runs chef shell-init powershell | iex
every time. So in a fresh shell, my path is:
~\Documents\github> path
C:/opscode/chef-workstation/bin
C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/bin
C:/opscode/chef-workstation/embedded/bin
C:\Program Files\PowerShell\7
C:\Program Files\ConEmu\ConEmu\Scripts
C:\Program Files\ConEmu
C:\Program Files\ConEmu\ConEmu
C:\Users\mcascone1\AppData\Local\Microsoft\WindowsApps
C:\Users\mcascone1\AppData\Roaming\npm
C:\Users\mcascone1\.dotnet\tools
C:\opscode\chef-workstation\bin\
C:\Program Files\Microsoft VS Code\bin
C:\ProgramData\chocolatey\bin
C:\Program Files\PowerShell\7\
C:\Program Files\Git\cmd
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\windows\system32
C:\windows
C:\windows\System32\Wbem
C:\windows\System32\WindowsPowerShell\v1.0\
C:\windows\System32\OpenSSH\
C:\Program Files\Intel\WiFi\bin\
C:\Program Files\Common Files\Intel\WirelessCommon\
C:\Program Files\Docker\Docker\resources\bin
C:\ProgramData\DockerDesktop\version-bin
C:\HashiCorp\Vagrant\bin
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\
C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\
C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\
C:\Program Files\Microsoft SQL Server\130\DTS\Binn\
C:\Program Files (x86)\Google\Chrome\Application
C:\Program Files\nodejs\
C:\Program Files\dotnet\
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow
C:/opscode/chef-workstation/embedded/git/usr/bin
This is the result of the shell-init at the launching of the shell. When i run refreshenv
, i get the path i would expect from my system settings:
~\Documents\github> refreshenv
Refreshing environment variables from the registry for powershell.exe. Please wait...
Finished
~\Documents\github> path
C:\opscode\chef-workstation\bin\
C:\Program Files\Microsoft VS Code\bin
C:\ProgramData\chocolatey\bin
C:\Program Files\PowerShell\7\
C:\Program Files\Git\cmd
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\windows\system32
C:\windows
C:\windows\System32\Wbem
C:\windows\System32\WindowsPowerShell\v1.0\
C:\windows\System32\OpenSSH\
C:\Program Files\Intel\WiFi\bin\
C:\Program Files\Common Files\Intel\WirelessCommon\
C:\Program Files\Docker\Docker\resources\bin
C:\ProgramData\DockerDesktop\version-bin
C:\HashiCorp\Vagrant\bin
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\
C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\
C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\
C:\Program Files\Microsoft SQL Server\130\DTS\Binn\
C:\Program Files (x86)\Google\Chrome\Application
C:\Program Files\nodejs\
C:\Program Files\dotnet\
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow
C:\Users\mcascone1\AppData\Local\Microsoft\WindowsApps
C:\Users\mcascone1\AppData\Roaming\npm
C:\Users\mcascone1\.dotnet\tools
Why would the shell-init be putting my user path in there? Especially with a chefdk
component in the path?
Anyway, i'll try installing with the refreshed path, and report.
Alright, now i really don't understand.
I reset my path, set $env:gem_home
and $env:gem_path
to $env:gem_root
which is C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
.
I even renamed C:\Users\mcascone1\AppData\Local\chefdk
to ...\chefdk-backup
.
I put the gem in my gemfile
and ran chef exec bundle install
.
It still installs into my chefdk folder! It creates a new one and installs to it!
> chef exec bundle info knife-vrealize
* knife-vrealize (6.0.0)
Summary: Chef Infra Knife plugin to interact with VMware vRealize.
Homepage: https://github.com/chef/knife-vrealize
Path: C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0
> path
C:\opscode\chef-workstation\bin\
C:\Program Files\Microsoft VS Code\bin
C:\ProgramData\chocolatey\bin
C:\Program Files\PowerShell\7\
C:\Program Files\Git\cmd
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\windows\system32
C:\windows
C:\windows\System32\Wbem
C:\windows\System32\WindowsPowerShell\v1.0\
C:\windows\System32\OpenSSH\
C:\Program Files\Intel\WiFi\bin\
C:\Program Files\Common Files\Intel\WirelessCommon\
C:\Program Files\Docker\Docker\resources\bin
C:\ProgramData\DockerDesktop\version-bin
C:\HashiCorp\Vagrant\bin
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\
C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\
C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\
C:\Program Files\Microsoft SQL Server\130\DTS\Binn\
C:\Program Files (x86)\Google\Chrome\Application
C:\Program Files\nodejs\
C:\Program Files\dotnet\
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow
C:\Users\mcascone1\AppData\Local\Microsoft\WindowsApps
C:\Users\mcascone1\AppData\Roaming\npm
C:\Users\mcascone1\.dotnet\tools
> $env:gem_home
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
> $env:gem_path
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
And i get the same ol' error when running knife vra
.
> knife vra catalog list --entitled
Traceback (most recent call last):
16: from C:/opscode/chef-workstation/bin/knife:370:in `<main>'
15: from C:/opscode/chef-workstation/bin/knife:370:in `load'
...
C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:30:in `<class:VraServerCreate>': uninitialized constant Chef::Knife::Cloud::VraServerCreate::VraServiceHelpers (NameError)
Did you mean? Chef::Knife::Cloud::VraServiceOptions
Where is that path configured?
this is still an issue, on multiple machines; any ideas?
i tried installing on a completely different machine and got exactly the same result. I can't even knife rehash
with this gem installed.
@dheerajd-msys this is going to become a big embarrassing issue for me in the very near future, how can i get this gem to work?
PS C:\Users\hl_tfsbuild> chef gem info knife-windows
*** LOCAL GEMS ***
knife-windows (4.0.5, 1.9.6)
Author: Seth Chisamore
Homepage: https://github.com/chef/knife-windows
License: Apache-2.0
Installed at (4.0.5): C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
(1.9.6): C:/Users/hl_tfsbuild/AppData/Local/chefdk/gem/ruby/2.7.0
Plugin that adds functionality to Chef's Knife CLI for
configuring/interacting with nodes running Microsoft Windows
PS C:\Users\hl_tfsbuild> chef gem install knife-vrealize
Fetching knife-vrealize-6.0.0.gem
WARNING: You don't have c:\users\hl_tfsbuild\appdata\local\chefdk\gem\ruby\2.7.0\bin in your PATH,
gem executables will not run.
Successfully installed knife-vrealize-6.0.0
Parsing documentation for knife-vrealize-6.0.0
Installing ri documentation for knife-vrealize-6.0.0
Done installing documentation for knife-vrealize after 14 seconds
1 gem installed
PS C:\Users\hl_tfsbuild> chef gem info knife-vrealize
*** LOCAL GEMS ***
knife-vrealize (6.0.0)
Author: Chef Software
Homepage: https://github.com/chef/knife-vrealize
License: Apache-2.0
Installed at: C:/Users/hl_tfsbuild/AppData/Local/chefdk/gem/ruby/2.7.0
Chef Infra Knife plugin to interact with VMware vRealize.
PS C:\Users\hl_tfsbuild> knife vra catalog list
FATAL: Cannot find subcommand for: 'vra catalog list'
If this is a recently installed plugin, please run 'knife rehash' to update the subcommands cache.
PS C:\Users\hl_tfsbuild> knife rehash
Traceback (most recent call last):
16: from C:/opscode/chef-workstation/bin/knife:370:in `<main>'
15: from C:/opscode/chef-workstation/bin/knife:370:in `load'
14: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/bin/knife:24:in `<top (required)>'
13: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/application/knife.rb:163:in `run'
12: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife.rb:224:in `run'
11: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife.rb:161:in `subcommand_class_from'
10: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:129:in `command_class_from'
9: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:115:in `load_command'
8: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `load_commands'
7: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `each'
6: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `block in load_commands'
5: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/chef-16.4.41-universal-mingw32/lib/chef/knife/core/subcommand_loader.rb:105:in `load'
4: from C:/Users/hl_tfsbuild/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:26:in `<top (required)>'
3: from C:/Users/hl_tfsbuild/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:27:in `<class:Chef>'
2: from C:/Users/hl_tfsbuild/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:28:in `<class:Knife>'
1: from C:/Users/hl_tfsbuild/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:29:in `<class:Cloud>'
C:/Users/hl_tfsbuild/AppData/Local/chefdk/gem/ruby/2.7.0/gems/knife-vrealize-6.0.0/lib/chef/knife/vra_server_create.rb:30:in `<class:VraServerCreate>': uninitialized constant Chef::Knife::Cloud::VraServerCreate::VraServiceHelpers (NameError)
Did you mean? Chef::Knife::Cloud::VraServiceOptions
PS C:\Users\hl_tfsbuild> chef gem uninstall knife-vrealize
Successfully uninstalled knife-vrealize-6.0.0
Based on this github issue, i got some more insight but i still don't know how to fix it.
prior to running chef shell-init powershell | iex
, I don't have $env:gem_home/path
set. After running that, they are set to the "bad" path:
> $env:gem_home
> chef shell-init powershell | iex
> $env:gem_home
C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0
> $env:gem_path
C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0;C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
But $env:gem_root
is still set to the 'good' path:
> $env:gem_root
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
The 'bad' path is visible in my Ruby env vars:
> chef gem env | select-string -Context 2 chefdk
- RUBY VERSION: 2.7.1 (2020-03-31 patchlevel 83) [x64-mingw32]
- INSTALLATION DIRECTORY: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
> - USER INSTALLATION DIRECTORY: C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0
- RUBY EXECUTABLE: C:/opscode/chef-workstation/embedded/bin/ruby.exe
- GIT EXECUTABLE: C:/opscode/chef-workstation/embedded/bin/git.BAT
- GEM PATHS:
- C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.7.0
> - C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0
- GEM CONFIGURATION:
- :update_sources => true
- SHELL PATH:
- C:/opscode/chef-workstation/bin
> - C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/bin
- C:/opscode/chef-workstation/embedded/bin
- C:\Program Files\PowerShell\7
I tried setting all the $env:gem_x
paths in my windows env vars, and opening a new shell, and those chefdk
paths just won't go away.
How can I get this chefdk path out of here, permanently?
@mwrock, you're my hero. Any idea when this will be released?
Should be soon. We are currently prepping a release.
Thank you so much. Do you have any insight on what's going on with the zombie chefdk
path, described in detail in the thread? Is it all related to the bug you fixed, or is something hinky with my environment (and on the other env I tested on and had the same problem)?
I think workstation adds that path but if it does not exist it should not have anything to do with the bug.
Just coming back to confirm that this appears to be fixed in v6.0.2. THANK YOU!!
Versions
Platform Details
Scenario
Get info from the vRA API using knife
Steps to Reproduce
Run
chef shell-init powershell | invoke-expression
Install the gem withchef gem install knife-vrealize
Run anyknife vra
command:knife vra server create
,knife vra catalog list
etcExpected Result
get the expected result of the commands - a server is spun up, the list is returned, etc
Actual Result
Fatal errors. One thing i notice is that the gem itself appears to be coming from
C:/Users/mcascone1/AppData/Local/chefdk/gem/ruby/2.7.0/gems/
. Is that correct? I thought that by usingchef gem install
and/orchef shell-init powershell
they'd be put in the right place.Fatal errors: