Skip to content

fix: Validate the existence of configured volume paths on an OS #27288

Open
AppCrashExpress wants to merge 8 commits intohashicorp:mainfrom
AppCrashExpress:fix/16968
Open

fix: Validate the existence of configured volume paths on an OS #27288
AppCrashExpress wants to merge 8 commits intohashicorp:mainfrom
AppCrashExpress:fix/16968

Conversation

@AppCrashExpress
Copy link

@AppCrashExpress AppCrashExpress commented Dec 20, 2025

Description

This PR adds simple validation for existence of configured host_volume path on OS, where nomad config validate is run.

Testing & Reproduction steps

Without the fix, the validation of config:

data_dir  = "/var/lib/nomad"

client {
  enabled       = true

  host_volume "avolume" {
    path = "/tmp/avolume"
  }
}

Runs successfully whether the file exists or not:

$ nomad config validate /tmp/config.hcl    
WARNING: mTLS is not configured - Nomad is not secure without mTLS!
Configuration is valid!

With the patch, it results in an error:

$ ./nomad-build config validate /tmp/config.hcl
WARNING: mTLS is not configured - Nomad is not secure without mTLS!
stat /tmp/avolume: no such file or directory
Configuration is invalid

Links

Fixes: #16968

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad product documentation, which is stored in the
    web-unified-docs repo. Refer to the web-unified-docs contributor guide for docs guidelines.
    Please also consider whether the change requires notes within the upgrade
    guide
    . If you would like help with the docs, tag the nomad-docs team in this PR.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.
  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

There are no changes to security controls.

@hashicorp-cla-app
Copy link

hashicorp-cla-app bot commented Dec 20, 2025

CLA assistant check
All committers have signed the CLA.

@hashicorp-cla-app
Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@AppCrashExpress AppCrashExpress changed the title fix: Validate the existence of volume paths on an OS fix: Validate the existence of configured volume paths on an OS Dec 20, 2025
@AppCrashExpress AppCrashExpress marked this pull request as ready for review December 20, 2025 14:28
@AppCrashExpress AppCrashExpress requested review from a team as code owners December 20, 2025 14:28
Path: dirPath,
},
{
Name: "test",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be able to set the same names here, really?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AppCrashExpress there is nothing stopping you setting the same string multiple times in table driven tests. That being said, the name "test" does not help identify the test being run here, so having a slightly more descriptive name would be good.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, no, I just thought that they must be unique in general. I have, however, changed the names of volumes just in case.

@mismithhisler mismithhisler self-assigned this Jan 5, 2026
@mismithhisler mismithhisler moved this from Needs Triage to Triaging in Nomad - Community Issues Triage Jan 5, 2026
@tgross tgross moved this from Triaging to In Progress in Nomad - Community Issues Triage Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Nomad config validate does not check for missing host_volume directories and daemon fails to start

4 participants