-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #490 from traylenator/mount
Support Mount units for manage_unit or dropin types
- Loading branch information
Showing
8 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'Systemd::Unit::Mount' do | ||
context 'with a key of What can have thing to mount' do | ||
it { is_expected.to allow_value({ 'What' => 'tmpfs' }) } | ||
it { is_expected.to allow_value({ 'What' => 'nfs://example.org/exports/home' }) } | ||
it { is_expected.to allow_value({ 'What' => '/dev/vda1' }) } | ||
end | ||
|
||
context 'with a key of Where can have a path to mount on' do | ||
it { is_expected.to allow_value({ 'Where' => '/mnt/foo' }) } | ||
it { is_expected.to allow_value({ 'Where' => '/mnt/foo/file.txt' }) } | ||
end | ||
|
||
context 'with a key of Type can have a path to mount on' do | ||
it { is_expected.to allow_value({ 'Type' => 'tmpfs' }) } | ||
it { is_expected.to allow_value({ 'Type' => 'ext2' }) } | ||
end | ||
|
||
context 'with a key of Options can have a path to mount on' do | ||
it { is_expected.to allow_value({ 'Options' => 'size=300M,mode=0700,uid=sssd,gid=sssd,root' }) } | ||
end | ||
|
||
context 'with a key of DirectoryMode can have a mode of' do | ||
it { is_expected.to allow_value({ 'DirectoryMode' => '0700' }) } | ||
end | ||
|
||
context 'with a key of TimeoutSec can have a mode of' do | ||
it { is_expected.to allow_value({ 'TimeoutSec' => '100' }) } | ||
it { is_expected.to allow_value({ 'TimeoutSec' => '5min 20s' }) } | ||
it { is_expected.to allow_value({ 'TimeoutSec' => '' }) } | ||
end | ||
|
||
%w[SloppyOptions LazyUnmount ReadWriteOnly ForceUnmount].each do |assert| | ||
context "with a key of #{assert} can have values of a path" do | ||
it { is_expected.to allow_value({ assert => false }) } | ||
it { is_expected.to allow_value({ assert => true }) } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# @summary Possible keys for the [Mount] section of a unit file | ||
# @see https://www.freedesktop.org/software/systemd/man/latest/systemd.mount.html | ||
# | ||
type Systemd::Unit::Mount = Struct[ | ||
{ | ||
Optional['What'] => String[1], | ||
Optional['Where'] => Stdlib::Unixpath, | ||
Optional['Type'] => String[1], | ||
Optional['Options'] => String[1], | ||
Optional['SloppyOptions'] => Boolean, | ||
Optional['LazyUnmount'] => Boolean, | ||
Optional['ReadWriteOnly'] => Boolean, | ||
Optional['ForceUnmount'] => Boolean, | ||
Optional['DirectoryMode'] => Stdlib::Filemode, | ||
Optional['TimeoutSec'] => String[0], | ||
} | ||
] |