Skip to content

fix(schema): require hostnames of at least 2 characters - #429

Merged
cmulk merged 1 commit into
sandialabs:mainfrom
GhostofGoes:fix-hostname-min-length
Sep 29, 2026
Merged

cmulk merged 1 commit into
sandialabs:mainfrom
GhostofGoes:fix-hostname-min-length

Conversation

@GhostofGoes

@GhostofGoes GhostofGoes commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Require topology node hostnames to be at least 2 characters long.

Background

The schema allowed 1-character hostnames, but two guest operating systems phenix configures reject them:

  • VyOS and Vyatta validate system host-name against [A-Za-z0-9][-.A-Za-z0-9]*[A-Za-z0-9], which needs at least 2 characters (VyOS docs, vyos-1x constraint). The same rule applies in legacy Vyatta and in every VyOS release since 1.2.
  • Windows DNS host names have a 2-character minimum (Microsoft Learn).

Linux (hostnamectl) accepts 1-character hostnames. Applying the minimum to every node keeps the rule in one place, and matches the limit the other supported guests already enforce.

Changes

  • minLength: 2 and pattern ^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$ in the v1 and v2 topology schemas, with a comment linking the references above.
  • The same change in the topology builder's client-side schemas, so the builder flags a 1-character hostname while editing.
  • Schema regression tests for 1, 2, and 63 characters.
  • CHANGELOG entry.

Related Issues/PRs

Type of Change

  • Bugfix (fix)
  • Feature (feat)
  • Documentation (docs)
  • Refactor (refactor)
  • Chore (CI, build, dependencies, etc.) (chore)
  • Other (please describe):

Checklist

  • This PR conforms to the process detailed in the Contributing Guide.
  • I have included no proprietary/sensitive information in my code or the PR.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • I have tested my code (describe below).

Testing

Tested manually on a phenix deployment. Normal topologies work, but a node with a 1-character hostname like r will fail validation.

Additional Notes

This is a stricter validation rule. A stored config with a 1-character hostname fails validation the next time it is created or updated, until the node is renamed. The topologies in sceptre-phenix-topologies have no 1-character hostnames.

Not covered here: minimega parses an all-numeric VM name as a count (vm launch kvm 42 launches 42 VMs), and the schema still accepts all-numeric hostnames.

🤖 Generated with Claude Code

@GhostofGoes
GhostofGoes marked this pull request as ready for review September 23, 2026 16:54
@GhostofGoes
GhostofGoes force-pushed the fix-hostname-min-length branch from b3a2e39 to 4f905d1 Compare September 23, 2026 17:01
@GhostofGoes GhostofGoes changed the title fix(types): require hostnames of at least 2 characters fix(schema): require hostnames of at least 2 characters Sep 23, 2026
@cmulk

cmulk commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

looks good, just a changelog conflict

@GhostofGoes
GhostofGoes force-pushed the fix-hostname-min-length branch from 4f905d1 to da76818 Compare September 28, 2026 21:50
@GhostofGoes

Copy link
Copy Markdown
Contributor Author

@cmulk resolved

VyOS and Vyatta validate `system host-name` against
`[A-Za-z0-9][-.A-Za-z0-9]*[A-Za-z0-9]`, and Windows DNS host names have
a 2-character minimum, so a topology node with a 1-character hostname
passed schema validation but could not be configured on those guests.

Raise the minimum hostname length from 1 to 2 in the v1 and v2 topology
schemas and in the topology builder's client-side schemas, and document
the reason with links to the VyOS and Microsoft references.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@GhostofGoes
GhostofGoes force-pushed the fix-hostname-min-length branch from da76818 to 275009f Compare September 29, 2026 03:31
@cmulk
cmulk merged commit 0460581 into sandialabs:main Sep 29, 2026
6 checks passed
@GhostofGoes
GhostofGoes deleted the fix-hostname-min-length branch September 29, 2026 15:26
cmulk pushed a commit that referenced this pull request Sep 29, 2026
phenix now rejects 1-character node hostnames because VyOS, Vyatta, and
Windows do not accept them. Update the hostname rules and the schema
reference to match, and link the VyOS and Microsoft references.

Migrated from sandialabs/sceptre-phenix-docs#70.

Refs: #429

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants