summaryrefslogtreecommitdiff
path: root/spec/unit/knife
Commit message (Collapse)AuthorAgeFilesLines
* Resolve our chefstyle warningsredundant_beginsTim Smith2021-04-011-1/+1
| | | | | | Now that knife has been moved we can resolve the current warnings Signed-off-by: Tim Smith <tsmith@chef.io>
* Move knife to its own gemChef Expeditor2021-03-31105-112/+344
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves knife into /knife, in the same way that chef-utils and chef-config are separated. NOTES: == File History == If you see this message as the first message in the history of an knife file, you can see the complete history by using 'git log --follow', 'git config log.follow true' to make it the default behavior in this repository, or 'git config --globa log.follow true' to make it the global default. == API Changes == At the API level, there is one breaking change: CookbookSiteStreamingUploader has been moved out of chef and into knife/core. There were a combination of reasons we chose this path: - CookbookSiteStreamingUploader (CSSU) is only used within Knife. - CookbookSiteStreamingUploader (CSSU) references the command Chef::Knife::CookbookMetadata in order to generate a metadata file for the cookbook to upload - Chef::Knife::CookbookMetadata is no longer available to Chef:: because Knife has been moved to its own gem. Knife gem depends on the Chef gem, so Chef can't depend on something in Knife. A search for usage in related projects (berks, chef-cli) and the Internet at large shows that there are no known external consumers of CSSU. For now, we'll move this class into Knife::Core, as it's going to be faster than splitting off the metadata generation and time is a concern. If we find that we need the metadata generation in chef/ proper, we should evaluate decoupling that functionality from Knife::CookbookMetadata and exposing it via something like `Chef::Cookbook::Metadata#from_cookbook_files` == spec changes == The specs are kept in their existing locations, though we have separated out a `knife_spec_helper` so that we can ensure knife is not directly accessing chef requires; and chef is relying on knife's at all. We also now clear gem paths with each test, to force gem state to reset. This works around a problem where a combination of tests is corrupting the internal Gem state, causing failures in rubygems_spec. See branch `mp/broken-gems` for many more details around findings so far. Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
* To remove verison v1 for root_rest objectsnehal/Merge_knife_plugin_into_Chefsnehaldwivedi2021-02-168-16/+16
| | | | Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
* Revert "Updated rest object URL and removed api_version 1"snehaldwivedi2021-02-168-40/+43
| | | | This reverts commit 182d83672e231c470e0b33ed777306a72a6bd76a.
* Updated rest object URL and removed api_version 1snehaldwivedi2021-02-168-43/+40
| | | | Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
* Updated API verion back to 1 and used user_v1snehaldwivedi2021-02-168-18/+18
| | | | Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
* Updated changes to remove userV1 and use root_rest objectsnehaldwivedi2021-02-168-65/+59
| | | | Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
* knife org edit NAME does not worksnehaldwivedi2021-02-161-0/+50
| | | | Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
* Fixed changes for prompt passwordsnehaldwivedi2021-02-161-0/+1
| | | | Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
* Updated reviewed changessnehaldwivedi2021-02-162-2/+3
| | | | Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
* Updated reviewed changes for copyrights and roo_restsnehaldwivedi2021-02-1610-73/+80
| | | | Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
* Fix Typosnehaldwivedi2021-02-161-4/+0
| | | | Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
* Updated reviewed changessnehaldwivedi2021-02-1616-508/+393
| | | | Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
* Merge this knife plugin into Chef directlysnehaldwivedi2021-02-1610-0/+683
| | | | Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
* remove unnecessary stubs and clean up outputLamont Granquist2021-02-011-5/+2
| | | | | | some garbage was getting output on stderr from the first block of tests Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix specs for spec 3.10Lamont Granquist2021-02-011-2/+4
| | | | | | | using a proper instance_double avoids the errors and that's the right thing to do here. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Merge pull request #10410 from chef/VSingh/knife-bootstrap-with-nonroot-userTim Smith2021-01-261-3/+42
|\ | | | | Signed-off-by: Tim Smith <tsmith@chef.io>
| * Rescue Train::UserError and re-try with su_passwordVSingh/knife-bootstrap-with-nonroot-userVivek Singh2020-09-181-5/+2
| | | | | | | | Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
| * Passed block and limits resursive callsVivek Singh2020-09-171-2/+2
| | | | | | | | Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
| * Add test casesVivek Singh2020-09-171-2/+44
| | | | | | | | Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
| * Fixed test case failureVivek Singh2020-09-171-1/+1
| | | | | | | | Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
* | Fix chefstyle violations.Pete Higgins2020-12-281-2/+2
| | | | | | | | Signed-off-by: Pete Higgins <pete@peterhiggins.org>
* | Fix knife status json output for EC2 instance with no public IP.Pete Higgins2020-12-281-0/+54
| | | | | | | | Signed-off-by: Pete Higgins <pete@peterhiggins.org>
* | Merge pull request #10779 from chef/Lint_ParenthesesAsGroupedExpressionTim Smith2020-12-281-1/+1
|\ \ | | | | | | Resolve Lint/ParenthesesAsGroupedExpression warnings
| * | Resolve Lint/ParenthesesAsGroupedExpression warningsLint_ParenthesesAsGroupedExpressionTim Smith2020-12-251-1/+1
| | | | | | | | | | | | | | | | | | Get some consistency here Signed-off-by: Tim Smith <tsmith@chef.io>
* | | Use include? instead of a regex with string matchingTim Smith2020-12-211-1/+1
|/ / | | | | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* | Cleanup bootstrap trusted_certs_dir tests.cleanup-bootstrap-certs-testsPete Higgins2020-12-171-17/+5
| | | | | | | | Signed-off-by: Pete Higgins <pete@peterhiggins.org>
* | Resolve indentation warnings from ChefstyleTim Smith2020-12-041-1/+1
| | | | | | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* | Roll back a few chefstyle fixesTim Smith2020-12-011-1/+1
| | | | | | | | | | | | These came with one of the newer releases of Rubocop Signed-off-by: Tim Smith <tsmith@chef.io>
* | Chefstyle fixes for RuboCop 1.4.xTim Smith2020-11-251-1/+1
| | | | | | | | | | | | There are some new spaces changes in RuboCop 1.4.2 Signed-off-by: Tim Smith <tsmith@chef.io>
* | Avoid ambiguous regexesambiguous_regexTim Smith2020-11-2113-34/+34
| | | | | | | | | | | | Just makes it a bit easier to read. Signed-off-by: Tim Smith <tsmith@chef.io>
* | Simplify regexes by removing extra character classesTim Smith2020-10-301-3/+3
|/ | | | | | We're working too hard here. No need for these. Signed-off-by: Tim Smith <tsmith@chef.io>
* Use __dir__ instead of getting the dir of __FILE__Tim Smith2020-09-091-6/+6
| | | | | | This is a bit easier to read Signed-off-by: Tim Smith <tsmith@chef.io>
* Merge pull request #9482 from MsysTechnologiesllc/dh/Fix-knife-ssh-hang-win2k16Tim Smith2020-08-211-2/+2
|\ | | | | Avoid knife ssh freeze on windows
| * fix specsdheerajd-msys2020-08-191-2/+2
| | | | | | | | Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
* | Add unit and integration testing back to omnibus testersLamont Granquist2020-08-171-0/+1
|/ | | | | | It is slow but it does catch real bugs Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix to render file_cache_path more "windows-native"Lamont Granquist2020-08-171-3/+3
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix crazy formattinglcg/fix-bootstrapping-path-issuesLamont Granquist2020-08-141-7/+11
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix the real issueLamont Granquist2020-08-141-7/+12
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Fix bootstrapping windows-from-linuxLamont Granquist2020-08-141-2/+2
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* File.exists? -> File.exist?existTim Smith2020-08-125-23/+23
| | | | | | Update some of these methods Signed-off-by: Tim Smith <tsmith@chef.io>
* Remove global state from cookbook uploader.fix-cookbook-uploader-global-statePete Higgins2020-07-211-3/+1
| | | | Signed-off-by: Pete Higgins <pete@peterhiggins.org>
* Remove unused codeVivek Singh2020-07-211-1/+0
| | | | Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
* Fix test casesVivek Singh2020-07-211-5/+2
| | | | Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
* The spec/ directory is in the path.fix-spec_helper-requiresPete Higgins2020-07-131-1/+1
| | | | Signed-off-by: Pete Higgins <pete@peterhiggins.org>
* Fix knife cookbook upload tests.snehaldwivedi2020-07-101-6/+5
| | | | Signed-off-by: Pete Higgins <pete@peterhiggins.org>
* Fix some odd whitespacing in tests.Pete Higgins2020-06-243-9/+9
| | | | Signed-off-by: Pete Higgins <pete@peterhiggins.org>
* Fix more typosTim Smith2020-06-231-1/+0
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* More aggressively deprecate config_valueLamont Granquist2020-06-221-0/+1
| | | | | | | | | | | | | | | Force subclasses to use the `config` hash directly. This should not affect any knife plugins shipping in chef-workstation since the calls to config_value have already been removed from all of those plugins. The multiple-argument version of config_value was not actually used anywhere in those plugins and the single value version was removed and replaced with accessing the config hash. Since that was introduced sometime in 15.x when the bootstrap changes went in, it is not expected that many external knife plugins have picked up the usage of config_value. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Warn during bootstrapping when using validation keyswarn_on_validator_bootstrapTim Smith2020-06-091-2/+2
| | | | | | | | | | | | | We should highly encourage users to move to validatorless bootstrapping 1) It's more secure 2) It requires less admin work since there no validation key to pass around or rotate This also provides an improved message helping the user to move off the old keys and fixes some bad formatting where the 2nd line was indented about 40 columns. Signed-off-by: Tim Smith <tsmith@chef.io>