Skip to content

Chef knife task does not include --config and --key when private key is selected #30

@gobananasgo

Description

@gobananasgo

When using the Execute Knife (Chef) task in Azure DevOps with a private key selected, only a --key flag gets added to the command that is run. A --config is not added, and errors are thrown at run time that a config is not specified.

[command]C:\windows\system32\cmd.exe /D /S /C "c:\opscode\chefdk\bin\knife.bat search environment "'name:*foobar*'" -i --key c:\windows\temp\foobar.pem"
No knife configuration file found. See https://docs.chef.io/config_rb_knife.html for details.

Sometimes, if an Execute Knife (Chef) step that does not use a private key is added before the tasks that do use a private key, then the commands have both --key and --config.
[command]C:\windows\system32\cmd.exe /D /S /C "c:\opscode\chefdk\bin\knife.bat search environment "'name:*foobar*'" -i --config c:\windows\temp\knife.rb --key c:\windows\temp\foobar.pem"

Once the --config and --key are available, the system attempts to connect to localhost, instead of the chef server specified in the server connection.
Connection refused connecting to https://localhost/search/environment?q=%27name:*foobar*%27&start=0&rows=1000

Bug fixes requested:

  • Allow a --key and --config file to both be generated and used when a Private Key is selected as a knife argument for the Execute Knife (Chef) task.

  • Use the chef server url specified in the Chef Server Connection instead of localhost

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions