Skip to content

Commit ae1b2f3

Browse files
authored
Merge pull request #11 from jonasduarte/master
Changed the method LinuxUpdateManager.initialize to add support to Amazon Linux
2 parents fc2a838 + c12bbe3 commit ae1b2f3

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

libraries/linux_updates.rb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,22 @@ class LinuxUpdateManager < Inspec.resource(1)
1313
name 'linux_update'
1414
desc 'Use the linux_update InSpec audit resource to test for available or installed updates'
1515

16+
# def initialize
17+
# if inspec.os.redhat?
18+
# @update_mgmt = RHELUpdateFetcher.new(inspec)
19+
# elsif inspec.os.debian?
20+
# @update_mgmt = UbuntuUpdateFetcher.new(inspec)
21+
# end
22+
# return skip_resource 'The `linux_update` resource is not supported on your OS.' if @update_mgmt.nil?
23+
# end
24+
25+
# Since Amazon Linux is based on RedHat, they may use the same method.
1626
def initialize
17-
if inspec.os.redhat?
18-
@update_mgmt = RHELUpdateFetcher.new(inspec)
19-
elsif inspec.os.debian?
20-
@update_mgmt = UbuntuUpdateFetcher.new(inspec)
27+
case inspec.os[:family]
28+
when 'redhat', 'amazon'
29+
@update_mgmt = RHELUpdateFetcher.new(inspec)
30+
when 'debian'
31+
@update_mgmt = UbuntuUpdateFetcher.new(inspec)
2132
end
2233
return skip_resource 'The `linux_update` resource is not supported on your OS.' if @update_mgmt.nil?
2334
end

0 commit comments

Comments
 (0)