Skip to content

Add FSAS_PROVISIONING_LANPORT_IDX handling - #77

Open
wilkowskia wants to merge 1 commit into
developmentfrom
task/4239
Open

Add FSAS_PROVISIONING_LANPORT_IDX handling#77
wilkowskia wants to merge 1 commit into
developmentfrom
task/4239

Conversation

@wilkowskia

Copy link
Copy Markdown
Collaborator

Summary

Makes the provisioning lanport index configurable via the new FSAS_PROVISIONING_LANPORT_IDX environment variable, instead of always using the hardcoded constant. This mirrors the existing pattern used for FSAS_SSH_MAX_ATTEMPTS.

Changes

  • Added a new getProvisioningLanportIdx() helper in fm.go that reads the FSAS_PROVISIONING_LANPORT_IDX env var:
    • Falls back to the default (PROVISIONING_LANPORT_IDX = 3) when the variable is unset.
    • Validates the value is a non-negative integer; on parse errors or negative values it logs the issue and falls back to the default.
    • Declared as a var function so it can be overridden in tests.
  • Used getProvisioningLanportIdx() when populating the provisioning subnet's LanportIdx in populateCreateMachineRequest.
  • Added TestGetProvisioningLanportIdx covering unset, valid positive, zero, non-numeric, and negative inputs.

Behavior

FSAS_PROVISIONING_LANPORT_IDX Result
unset default (3)
valid non-negative int (e.g. 5, 0) uses the provided value
non-numeric (e.g. abc) default (3)
negative (e.g. -1) default (3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants