-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
96 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pi::cmdline { '8250.nr_uarts=0': } | ||
pi::cmdline { 'coherent_pool=1M': } | ||
pi::cmdline { 'snd_bcm2835.enable_headphones=0': } |
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 @@ | ||
include pi |
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,14 @@ | ||
(* /boot/cmdline.txt module for Augeas *) | ||
|
||
module Boot_Cmdline = | ||
autoload xfm | ||
|
||
let word = /[^ \n\t]+/ | ||
let cmdline = [ seq "cmdline" . Util.indent . | ||
[ label "parameter" . store word ] . | ||
[ label "parameter" . Sep.space . store word ]* | ||
. Util.eol ] | ||
|
||
let lns = cmdline | ||
|
||
let xfm = transform lns (incl "/boot/cmdline.txt") |
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,30 @@ | ||
# @summary | ||
# Manage /boot/cmdline.txt kernel parameters. | ||
# | ||
# @param parameter | ||
# The kernel parameter to manage. E.g. 8250.nr_uarts=1 | ||
# | ||
# Note that the management of parameters is not very intelligent. | ||
# 8250.nr_uarts=1 and 8250.nr_uarts=2 would be treated as two different | ||
# parameters. | ||
# | ||
define pi::cmdline ( | ||
Optional[String[1]] $parameter = undef, | ||
) { | ||
include pi | ||
|
||
$_real_parameter = $parameter ? { | ||
undef => $name, | ||
default => $parameter, | ||
} | ||
|
||
augeas { $name: | ||
context => '/files/boot/cmdline.txt/1', | ||
lens => 'Boot_Cmdline.lns', | ||
incl => '/boot/cmdline.txt', | ||
changes => [ | ||
"set parameter[. = '${_real_parameter}'] '${_real_parameter}'", | ||
], | ||
require => Augeas::Lens['boot_cmdline'], | ||
} | ||
} |
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,18 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper_acceptance' | ||
|
||
describe 'pi::cmdline define' do | ||
context 'without any parameters' do | ||
before(:context) do | ||
shell('mkdir -p /boot') | ||
create_remote_file('default', '/boot/cmdline.txt', 'console=serial0,115200 console=tty1 root=PARTUUID=4a435670-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles') | ||
end | ||
|
||
include_examples 'the example', 'cmdline.pp' | ||
|
||
describe file('/boot/cmdline.txt') do | ||
it { is_expected.to be_file } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper_acceptance' | ||
|
||
describe 'pi class' do | ||
context 'without any parameters' do | ||
include_examples 'the example', 'pi.pp' | ||
|
||
describe file('/opt/puppetlabs/puppet/share/augeas/lenses/boot_cmdline.aug') do | ||
it { is_expected.to be_file } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'pi' do | ||
on_supported_os.each do |os, os_facts| | ||
context "on #{os}" do | ||
# camptocamp/augeas 1.9.0 is using legacy facts | ||
let(:facts) { override_facts(os_facts, osfamily: os_facts[:os]['family']) } | ||
|
||
it { is_expected.to compile.with_all_deps } | ||
end | ||
end | ||
end |