This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch master
in repository 389-ds-base.
commit 8ce1d38b944c2388bb19299cf346027442208b01
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Jan 29 23:53:59 2018 -0500
Ticket 49548 - Cockpit UI - installer should also setup
Cockpit
Description: Add option to installer to also configure Cockpit:
- Add port to firewall (if running),
- Enable/start the Cockpit socket.
https://pagure.io/389-ds-base/issue/49548
Reviewed by: firstyear(Thanks!)
---
src/lib389/cli/ds-cockpit-setup | 63 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 62 insertions(+), 1 deletion(-)
diff --git a/src/lib389/cli/ds-cockpit-setup b/src/lib389/cli/ds-cockpit-setup
index a722085..c1fcc4c 100755
--- a/src/lib389/cli/ds-cockpit-setup
+++ b/src/lib389/cli/ds-cockpit-setup
@@ -43,6 +43,9 @@ if __name__ == '__main__':
parser.add_argument('-i', '--install',
help="Install the cockpit plugin (must be root)",
action='store_true', dest='install', default=False)
+ parser.add_argument('-c', '--cockpit',
+ help="Enable Cockpit on the system",
+ action='store_true', dest='enable_cockpit', default=False)
parser.add_argument('-t', '--testing',
help="Install the cockpit plugin under users's home directory for
testing (~/.local/share/cockpit)",
action='store_true', dest='testing', default=False)
@@ -106,6 +109,64 @@ if __name__ == '__main__':
print("Failed to install cockpit plugin: " + str(e))
sys.exit(1)
+ # Setup and Enabled Cockpit
+ if options.enable_cockpit:
+ firewall = False
+ print("Enabling Cockpit...")
+
+ # Is the firewall running
+ if options.verbose:
+ print("Checking firewall...")
+ try:
+ cmd = ["firewall-cmd", "--state",]
+ subprocess.check_call(cmd, stdout=subprocess.PIPE)
+ firewall = True
+ except:
+ if options.verbose:
+ print("Firewall not running")
+
+
+ # Configure firewall for port 9090 and set it permanent
+ if firewall:
+ if options.verbose:
+ print("Opening port 9090 in firewall...")
+ try:
+ cmd = ["firewall-cmd", "--add-port=9090/tcp",]
+ subprocess.check_call(cmd, stdout=subprocess.PIPE)
+ except:
+ print ("Failed to add port 9090 to the firewall")
+ sys.exit(1)
+
+ if options.verbose:
+ print("Setting 9090 permanent in firewall...")
+ try:
+ cmd = ["firewall-cmd",
"--permanent","--add-port=9090/tcp"]
+ subprocess.check_call(cmd, stdout=subprocess.PIPE)
+ except:
+ print("Failed to add port 9090 to the firewall")
+ sys.exit(1)
+
+ # Enable and start Cockpit socket
+ if options.verbose:
+ print("Enabling Cockpit socket...")
+ try:
+ cmd = ["systemctl", "enable","cockpit.socket"]
+ subprocess.check_call(cmd, stdout=subprocess.PIPE)
+ except:
+ print ("Failed to enable cockpit socket")
+ sys.exit(1)
+
+ if options.verbose:
+ print("Starting Cockpit socket...")
+ try:
+ cmd = ["systemctl", "start","cockpit.socket"]
+ subprocess.check_call(cmd, stdout=subprocess.PIPE)
+ except:
+ print("Failed to start cockpit socket")
+ sys.exit(1)
+
+ print("Cockpit has been enabled and started.")
+
# Done!
print("Installation is complete!")
- print("Open UI with this URL:
http://{}:9090/389-console".format(socket.getfqdn()))
+ print("Open UI with this URL: http://{}:9090/".format(socket.getfqdn()))
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.