Skip to content

Instantly share code, notes, and snippets.

@bschonec
Last active June 19, 2024 19:29
Show Gist options
  • Save bschonec/2c8116cdf1dbd0e2cfd19af27e2b04b9 to your computer and use it in GitHub Desktop.
Save bschonec/2c8116cdf1dbd0e2cfd19af27e2b04b9 to your computer and use it in GitHub Desktop.
concat {'/tmp/junk.txt':
ensure => present,
}
$a = [1, 3, 5, 7, 9]
$b = [2, 4, 6, 8, 10]
$a.each |$value| {
concat::fragment {"odds-${value}":
target => '/tmp/junk.txt',
content => "$value \n",
order => numeric
}
}
$b.each |$value| {
concat::fragment {"evens-${value}":
target => '/tmp/junk.txt',
content => "$value \n",
order => numeric,
}
}
@bschonec
Copy link
Author

Resultant file /tmp/junk:

10
2
4
6
8
1
3
5
7
9

Desired output:

1
2
3
4
5
6
7
8
9
10

@bschonec
Copy link
Author

Changing the order paremeter has no affect:

concat {'/tmp/junk.txt':
  ensure =>  present,
}

$a = [1, 3, 5, 7, 9]
$b = [2, 4, 6, 8, 10]

$a.each |$value| {
  concat::fragment {"odds-${value}":
    target  => '/tmp/junk.txt',
    content => "$value \n",
    order   => '10',
  }
}

$b.each |$value| {
  concat::fragment {"evens-${value}":
    target  => '/tmp/junk.txt',
    content => "$value \n",
    order   => '10',
  }
}

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