Skip to content

ensure correct ordering of concat::fragments#171

Open
kBite wants to merge 1 commit intovoxpupuli:masterfrom
kBite:fix-ordering-of-fragments
Open

ensure correct ordering of concat::fragments#171
kBite wants to merge 1 commit intovoxpupuli:masterfrom
kBite:fix-ordering-of-fragments

Conversation

@kBite
Copy link
Copy Markdown
Contributor

@kBite kBite commented Jan 31, 2024

Fragments that share the same order number are ordered by name.

"${chain}-${interface}-aaa"
"${chain}-${interface}-${name}"
"${chain}-${interface}-zzz"

If name starts with upper case letter they're placed outside of interface eth0 {}:

  mod comment comment 'AAA-minimal_example' proto all ACCEPT;
interface eth0 {
  mod comment comment 'aaa-minimal_example:' proto all ACCEPT;
  mod comment comment 'minimal_example' proto all ACCEPT;
}

I looked into testing for correct ordering, but didn't find a working solution.

There is (e.g.) .that_comes_before, but that's testing against before => ....

I also unsuccessfully tried testing against the content of File[/etc/ferm.d/chains/INPUT.conf] generated by concat_file.

@kBite kBite self-assigned this Jan 31, 2024
@kBite kBite force-pushed the fix-ordering-of-fragments branch from 48d86ff to 365e2d2 Compare February 17, 2025 11:58
@kBite
Copy link
Copy Markdown
Contributor Author

kBite commented Feb 17, 2025

@bastelfreak Do you have an idea how to test for correct ordering?

> Fragments that share the same order number are ordered by name.
```
"${chain}-${interface}-aaa"
"${chain}-${interface}-${name}"
"${chain}-${interface}-zzz"
```

If `name` starts with upper case letter they're placed outside of
`interface eth0 {}`:

```
  mod comment comment 'AAA-minimal_example' proto all ACCEPT;
interface eth0 {
  mod comment comment 'aaa-minimal_example:' proto all ACCEPT;
  mod comment comment 'minimal_example' proto all ACCEPT;
}
```
@kBite kBite force-pushed the fix-ordering-of-fragments branch from 365e2d2 to 2ac5fd5 Compare April 7, 2025 14:23
@alexjfisher
Copy link
Copy Markdown
Member

With rspec-puppet, I don't think you can test the final file output to verify the ordering, as concat_file generates the File resource on the agent at apply time, and not as part of the normal catalog compilation process.

This module does have acceptance tests though. You should be able to test post apply file content with these if you want.

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