-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed: * Moved the puppetx/augeasproviders_grub/menuentry.rb file to util.rb to match the module name * Modified all `flush` functions to call the 'global update' mkconfig which was added as `PuppetX::AugeasprovidersGrub::Util.mkconfig` * Removed EL6 from the beaker tests since the OS is no longer supported by the vendor and fails to run Added: * Puppet 7 support * EL8.1+ support Changed: * Updated the travis.yml to run faster Closes #63 fix super calls in flush try to speed up travis builds install unbuffer in travis fix provider inheritance add augeas tools
- Loading branch information
1 parent
5378c62
commit 63c2c4b
Showing
11 changed files
with
129 additions
and
165 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
language: ruby | ||
sudo: required | ||
version: ~> 1.0 | ||
os: linux | ||
sudo: false | ||
bundler_args: --without development system_tests --path vendor | ||
|
||
addons: | ||
apt: | ||
packages: | ||
# provides unbuffer | ||
- expect-dev | ||
- libaugeas-dev | ||
- augeas-tools | ||
|
||
rvm: | ||
- 2.4.4 | ||
- 2.5.8 | ||
notifications: | ||
email: | ||
- [email protected] | ||
|
@@ -11,15 +23,13 @@ env: | |
- PUPPET=5.5 RUBY_AUGEAS=0.5 FORGE_PUBLISH=true | ||
# Test latest Puppet version | ||
- PUPPET=6 RUBY_AUGEAS=0.5 | ||
|
||
- PUPPET=7 RUBY_AUGEAS=0.5 | ||
|
||
matrix: | ||
fast_finish: true | ||
|
||
install: | ||
- "travis_retry ./.travis.sh" | ||
script: | ||
- AUGEAS_LENS_LIB=lib/augeas/lenses:augeas/lenses bundle exec rake | ||
- AUGEAS_LENS_LIB=lib/augeas/lenses:augeas/lenses travis_wait 45 unbuffer bundle exec rake | ||
# Do not include the augeas/ directory in the deployed module | ||
- rm -rf augeas/ | ||
deploy: | ||
|
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
# Copyright (c) 2016 Trevor Vaughan <[email protected]> | ||
# Licensed under the Apache License, Version 2.0 | ||
|
||
Puppet::Type.type(:grub_menuentry).provide(:grub2) do | ||
Puppet::Type.type(:grub_menuentry).provide(:grub2, :parent => Puppet::Type.type(:augeasprovider).provider(:default)) do | ||
desc "Provides for the manipulation of GRUB2 menuentries" | ||
|
||
has_feature :grub2 | ||
|
@@ -236,7 +236,7 @@ def self.grub2_menuentries(config, current_default) | |
end | ||
|
||
def self.instances | ||
require 'puppetx/augeasproviders_grub/menuentry' | ||
require 'puppetx/augeasproviders_grub/util' | ||
|
||
@grubby_default_index ||= (grubby '--default-index').strip | ||
|
||
|
@@ -269,7 +269,7 @@ def self.prefetch(resources) | |
def initialize(*args) | ||
super(*args) | ||
|
||
require 'puppetx/augeasproviders_grub/menuentry' | ||
require 'puppetx/augeasproviders_grub/util' | ||
|
||
@grubby_info = {} | ||
begin | ||
|
@@ -490,6 +490,10 @@ def initrd=(newval) | |
end | ||
|
||
def flush | ||
super | ||
|
||
require 'puppetx/augeasproviders_grub/util' | ||
|
||
@property_hash[:name] = self.name | ||
|
||
if @property_hash[:kernel] =~ /(\d.+)/ | ||
|
@@ -536,7 +540,7 @@ def flush | |
FileUtils.rm_f(legacy_target) | ||
|
||
# Need to rebuild the full grub config if we removed a legacy target | ||
grub2_mkconfig | ||
PuppetX::AugeasprovidersGrub::Util.grub2_mkconfig(mkconfig) | ||
end | ||
end | ||
else | ||
|
@@ -568,7 +572,7 @@ def flush | |
# Need to remove the BLS config if we moved it to be legacy | ||
FileUtils.rm_f(bls_target) if File.exist?(bls_target) | ||
|
||
grub2_mkconfig | ||
PuppetX::AugeasprovidersGrub::Util.grub2_mkconfig(mkconfig) | ||
end | ||
end | ||
|
||
|
@@ -746,51 +750,4 @@ def construct_grub2cfg_entry(property_hash, header_comment='### PUPPET MANAGED # | |
|
||
return output | ||
end | ||
|
||
# Run the grub2-mkconfig command on the discovered file paths deconflicting | ||
# across symlinks | ||
def grub2_mkconfig(cfg_paths=[]) | ||
tgt_files = [] | ||
|
||
os_info = Facter.value(:os) | ||
if os_info | ||
os_name = Facter.value(:os)['name'] | ||
else | ||
# Support for old versions of Facter | ||
unless os_name | ||
os_name = Facter.value(:operatingsystem) | ||
end | ||
end | ||
|
||
cfg_paths = [ | ||
"/etc/grub2.cfg", | ||
"/etc/grub2-efi.cfg", | ||
# Handle the standard EFI naming convention | ||
"/boot/efi/EFI/#{os_name.downcase}/grub.cfg", | ||
"/boot/grub2/grub.cfg", | ||
"/boot/grub/grub.cfg" | ||
] if cfg_paths.empty? | ||
|
||
cfg_paths.each do |path| | ||
begin | ||
tgt_files << File.realpath(path) | ||
rescue | ||
next | ||
end | ||
end | ||
|
||
cfg_paths = cfg_paths.select{|x| FileTest.file?(x)} | ||
|
||
fail("Cannot find a grub configuration at any of '#{cfg_paths.join(', ')}' to use with #{command(:mkconfig)}") if cfg_paths.empty? | ||
|
||
# This takes a while to run | ||
mkconfig_output = mkconfig | ||
|
||
tgt_files.uniq.each do |cfg_path| | ||
File.open(cfg_path, 'w') do |fh| | ||
fh.puts(mkconfig_output) | ||
fh.flush | ||
end | ||
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
# Copyright (c) 2016 Trevor Vaughan <[email protected]> | ||
# Licensed under the Apache License, Version 2.0 | ||
|
||
Puppet::Type.type(:grub_user).provide(:grub2) do | ||
Puppet::Type.type(:grub_user).provide(:grub2, :parent => Puppet::Type.type(:augeasprovider).provider(:default)) do | ||
desc "Provides for the manipulation of GRUB2 User Entries" | ||
|
||
has_feature :grub2 | ||
|
@@ -21,7 +21,7 @@ def self.mkconfig_path | |
mk_resource_methods | ||
|
||
def self.grub2_cfg | ||
require 'puppetx/augeasproviders_grub/menuentry' | ||
require 'puppetx/augeasproviders_grub/util' | ||
|
||
PuppetX::AugeasprovidersGrub::Util.grub2_cfg | ||
end | ||
|
@@ -31,7 +31,7 @@ def grub2_cfg | |
end | ||
|
||
def self.grub2_cfg_path | ||
require 'puppetx/augeasproviders_grub/menuentry' | ||
require 'puppetx/augeasproviders_grub/util' | ||
|
||
PuppetX::AugeasprovidersGrub::Util.grub2_cfg_path | ||
end | ||
|
@@ -223,6 +223,8 @@ def purge | |
end | ||
|
||
def flush | ||
super | ||
|
||
# This is to clean up the legacy file that was put in place incorrectly | ||
# prior to the standard 01_users configuration file | ||
legacy_file = '/etc/grub.d/01_puppet_managed_users' | ||
|
@@ -275,7 +277,7 @@ def flush | |
# This really shouldn't happen but could if people start adding users in other files. | ||
if output == @property_hash[:_target_file_content] | ||
err("Please ensure that your *active* GRUB2 configuration is correct. #{self.class} thinks that you need an update, but your file content did not change") | ||
else output == @property_hash[:_target_file_content] | ||
else | ||
fh = File.open(resource[:target], 'w') | ||
fh.puts(output) | ||
fh.flush | ||
|
@@ -284,7 +286,8 @@ def flush | |
FileUtils.chmod(0755, resource[:target]) | ||
end | ||
|
||
mkconfig "-o", grub2_cfg_path | ||
require 'puppetx/augeasproviders_grub/util' | ||
PuppetX::AugeasprovidersGrub::Util.grub2_mkconfig(mkconfig) | ||
end | ||
|
||
private | ||
|
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
Oops, something went wrong.