-
-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use structured-facts for array values instead of joining them by , #120
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,7 +94,7 @@ | |
$minimal_requirements = false | ||
} | ||
|
||
if getvar('::gluster_volume_list') and member( split( $::gluster_volume_list, ',' ), $title ) { | ||
if getvar('::gluster_volume_list') and member( $::gluster_volume_list, $title ) { | ||
$already_exists = true | ||
} else { | ||
$already_exists = false | ||
|
@@ -109,7 +109,7 @@ | |
# first, get a list of unique server names hosting bricks | ||
$brick_hosts = unique( regsubst( $bricks, '^([^:]+):(.+)$', '\1') ) | ||
# now get a list of all peers, including ourself | ||
$pool_members = concat( split( $::gluster_peer_list, ','), [ $::fqdn ] ) | ||
$pool_members = concat($::gluster_peer_list, [ $::fqdn ] ) | ||
# now see what the difference is | ||
$missing_bricks = difference( $brick_hosts, $pool_members) | ||
|
||
|
@@ -163,7 +163,7 @@ | |
# this volume exists | ||
|
||
# our fact lists bricks comma-separated, but we need an array | ||
$vol_bricks = split( getvar( "::gluster_volume_${title}_bricks" ), ',') | ||
$vol_bricks = getvar( "::gluster_volume_${title}_bricks" ) | ||
if $bricks != $vol_bricks { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @coder-hugo Do you think the arrays can be sorted before they're compared (and operated on)? This would fix #121 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd say it would be even better to sort the arrays already when generating the facts. I'll just try this now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a patch that sorts all array facts and also the |
||
# this resource's list of bricks does not match the existing | ||
# volume's list of bricks | ||
|
@@ -226,7 +226,7 @@ | |
# did the options change? | ||
$current_options = getvar("gluster_volume_${title}_options") | ||
if $current_options { | ||
$_current = sort( split($current_options, ',') ) | ||
$_current = sort( $current_options ) | ||
} else { | ||
$_current = [] | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having read a bit more, I'm not actually sure this is the correct thing to do. Brick order is important?
See #121 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. After a short look to the documentation I'd say the brick order is important for stripped and distributed volumes. So it looks like #121 isn't a bug in this module but in the puppet configuration of the author of #121.