Skip to content

Harden argument validation in knife bootstrap with structured error messages #119

@nikhil2611

Description

@nikhil2611

Epic

Part of Crawl Track backlog epic.

Background

Ex5 (API Hardening) improved validation in several commands. knife bootstrap is the highest-risk command (executes remote code) and still has gaps: invalid node names, missing required flags, and conflicting options produce cryptic errors or silent failures.

Code Paths

  • lib/chef/knife/bootstrap.rb#validate_options! and #run
  • lib/chef/knife/bootstrap/train_connector.rb — connection validation
  • spec/unit/knife/bootstrap_spec.rb — existing tests (expand these)

Acceptance Criteria

  • validate_options! raises Chef::Exceptions::InvalidBootstrapArguments (or equivalent) with a human-readable message for: missing host, invalid node name chars, conflicting --sudo + --no-sudo
  • Error messages include the offending value and a hint (e.g. "Node name bad name contains spaces — use hyphens instead")
  • New specs cover each validation branch
  • No change to happy-path behavior

Dependencies

  • Depends on: Ex5 API hardening patterns (already merged)
  • Blocks: nothing

Estimated Size

Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions