Skip to content

Commit 3b963e1

Browse files
committed
Adding example for Red Hat Subscription Manager hosted
Uses Subscription Manager on RHEL machines to connect to the customer portal, attach to the first available subscription, check for updates and apply them if available.
1 parent ec5cfd8 commit 3b963e1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
$:.push("../lib")
2+
require 'linux_admin'
3+
4+
username = "MyUsername"
5+
password = "MyPassword"
6+
7+
8+
reg_status = LinuxAdmin.registered?
9+
puts "Registration Status: #{reg_status.to_s}"
10+
11+
unless reg_status
12+
puts "Registering to Subscription Manager..."
13+
LinuxAdmin::SubscriptionManager.register(:username => username, :password => password)
14+
end
15+
16+
reg_type = LinuxAdmin.registration_type
17+
puts "Registration System: #{reg_type}"
18+
19+
puts "Subscribing to channels..."
20+
reg_type.subscribe(reg_type.available_subscriptions.keys.first)
21+
puts "Checking for updates..."
22+
if LinuxAdmin::Yum.updates_available?
23+
puts "Updates Available \n Updating..."
24+
puts "Updates Applied" if LinuxAdmin::Yum.update
25+
end

0 commit comments

Comments
 (0)