Context
Walk Ex3 replaced duplicate inline nil-guard blocks in node_show.rb, client_show.rb, and role_show.rb with calls to the existing test_mandatory_field helper. At least 15 other knife commands still use the inline pattern.
Code Paths
lib/chef/knife/node_edit.rb:43
lib/chef/knife/role_create.rb:42
lib/chef/knife/client_edit.rb:36
lib/chef/knife/cookbook_download.rb:60
lib/chef/knife/environment_show.rb:38
lib/chef/knife/ssh.rb:612
lib/chef/knife/tag_list.rb:38
lib/chef/knife/role_delete.rb:37
lib/chef/knife/user_reregister.rb:41
- (and ~6 more —
grep -rn 'ui.fatal.*must specify' lib/)
Acceptance Criteria
Dependencies
None — safe to start immediately.
Size
Medium — one PR, no logic changes, pure refactor.
Context
Walk Ex3 replaced duplicate inline nil-guard blocks in
node_show.rb,client_show.rb, androle_show.rbwith calls to the existingtest_mandatory_fieldhelper. At least 15 other knife commands still use the inline pattern.Code Paths
lib/chef/knife/node_edit.rb:43lib/chef/knife/role_create.rb:42lib/chef/knife/client_edit.rb:36lib/chef/knife/cookbook_download.rb:60lib/chef/knife/environment_show.rb:38lib/chef/knife/ssh.rb:612lib/chef/knife/tag_list.rb:38lib/chef/knife/role_delete.rb:37lib/chef/knife/user_reregister.rb:41grep -rn 'ui.fatal.*must specify' lib/)Acceptance Criteria
if @name_args[0].nil? ... ui.fatal ... exit 1blocks inlib/chef/knife/*.rbreplaced withtest_mandatory_fieldDependencies
None — safe to start immediately.
Size
Medium — one PR, no logic changes, pure refactor.