Skip to content

Commit

Permalink
Allow EnvironmentFile to be an array
Browse files Browse the repository at this point in the history
It's valid to set EnvironmentFile multiple times and this reflects that
possibility. It also enhances the regex to at least require one
character, so that -/ is considered invalid.
  • Loading branch information
ekohl committed Mar 20, 2023
1 parent 727c4be commit 3dde677
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2182,7 +2182,7 @@ Struct[{
Optional['OOMPolicy'] => Enum['continue', 'stop','kill'],
Optional['OOMScoreAdjust'] => Integer[-1000,1000],
Optional['Environment'] => String,
Optional['EnvironmentFile'] => Variant[Stdlib::Unixpath,Pattern[/-\/.*/]],
Optional['EnvironmentFile'] => Variant[Stdlib::Unixpath,Pattern[/-\/.+/], Array[Stdlib::Unixpath,Pattern[/-\/.+/],1]],
}]
```

Expand Down
2 changes: 2 additions & 0 deletions spec/type_aliases/systemd_unit_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@

it { is_expected.to allow_value({ 'EnvironmentFile' => '/etc/sysconfig/foo' }) }
it { is_expected.to allow_value({ 'EnvironmentFile' => '-/etc/sysconfig/foo' }) }
it { is_expected.to allow_value({ 'EnvironmentFile' => ['/etc/sysconfig/foo', '-/etc/sysconfig/foo-bar'] }) }
it { is_expected.not_to allow_value({ 'EnvironmentFile' => '-/' }) }
it { is_expected.not_to allow_value({ 'EnvironmentFile' => 'relative-path.sh' }) }
end
2 changes: 1 addition & 1 deletion types/unit/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
Optional['OOMPolicy'] => Enum['continue', 'stop','kill'],
Optional['OOMScoreAdjust'] => Integer[-1000,1000],
Optional['Environment'] => String,
Optional['EnvironmentFile'] => Variant[Stdlib::Unixpath,Pattern[/-\/.*/]],
Optional['EnvironmentFile'] => Variant[Stdlib::Unixpath,Pattern[/-\/.+/], Array[Stdlib::Unixpath,Pattern[/-\/.+/],1]],
}
]

0 comments on commit 3dde677

Please sign in to comment.