Skip to content

Conversation

@poquirion
Copy link
Member

Add condition to check if nfs_volumes is defined before mounting shares.

Add condition to check if nfs_volumes is defined before mounting shares.
$nfs_volumes = $instances.dig($nfs_server, 'volumes', 'nfs')
$shares_to_mount = keys($nfs_volumes) + $share_names
if $nfs_volumes != undef {
$shares_to_mount = keys($nfs_volumes) + $share_names
Copy link
Member

@mboisson mboisson Jan 19, 2026

Choose a reason for hiding this comment

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

hum, this still does the keys(...) + $share_names even if it's undef.

And it discards $share_names if it's undef.

Copy link
Member

@cmd-ntrf cmd-ntrf Jan 19, 2026

Choose a reason for hiding this comment

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

As @mboisson said, $shares_to_mount initialization needs to be based on wether nfs_volumes is undef or not.

if $nfs_volumes != undef {
    $shares_to_mount = keys($nfs_volumes) + $share_names
} else {
    $shares_to_mount = $share_names
}

I am digging if I can come up with a one-liner, but this works.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe something like

  $shares_to_mount = $nfs_volume != undef ? { keys($nfs_volumes) + $share_names, $share_names }

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, typos in my patch

Copy link
Member Author

@poquirion poquirion Jan 19, 2026

Choose a reason for hiding this comment

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

  $shares_to_mount = keys($nfs_volumes)
  if $nfs_volumes != undef {
    $shares_to_mount = keys($nfs_volumes) + $share_names
  }

Is default and if ok with you @cmd-ntrf ?

@mboisson
Copy link
Member

This relates to #498

@cmd-ntrf
Copy link
Member

Superseded by PR #500.

@cmd-ntrf cmd-ntrf closed this Jan 19, 2026
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.

3 participants