From 29d0dd6678f124d0e0be9e9357ceb4b453966cec Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 21 Jul 2021 12:47:43 -0400 Subject: [PATCH] Add missing profile content for cloning --- .../profiles/default/scripts/onboot.custom | 0 .../profiles/default/scripts/post.sh | 32 +++++++++++++++++++ confluent_server/confluent/core.py | 4 +++ .../plugins/hardwaremanagement/redfish.py | 6 ++++ 4 files changed, 42 insertions(+) create mode 100644 confluent_osdeploy/el8-diskless/profiles/default/scripts/onboot.custom create mode 100644 confluent_osdeploy/el8-diskless/profiles/default/scripts/post.sh diff --git a/confluent_osdeploy/el8-diskless/profiles/default/scripts/onboot.custom b/confluent_osdeploy/el8-diskless/profiles/default/scripts/onboot.custom new file mode 100644 index 00000000..e69de29b diff --git a/confluent_osdeploy/el8-diskless/profiles/default/scripts/post.sh b/confluent_osdeploy/el8-diskless/profiles/default/scripts/post.sh new file mode 100644 index 00000000..8635f0db --- /dev/null +++ b/confluent_osdeploy/el8-diskless/profiles/default/scripts/post.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# This script is executed 'chrooted' into a cloned disk target before rebooting +# + +nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}') +confluent_apikey=$(cat /etc/confluent/confluent.apikey) +confluent_mgr=$(grep deploy_server /etc/confluent/confluent.deploycfg|awk '{print $2}') +confluent_profile=$(grep ^profile: /etc/confluent/confluent.deploycfg|awk '{print $2}') +export nodename confluent_mgr confluent_profile +. /etc/confluent/functions +mkdir -p /var/log/confluent +exec >> /var/log/confluent/confluent-post.log +exec 2>> /var/log/confluent/confluent-post.log +tail -f /var/log/confluent/confluent-post.log > /dev/console & +logshowpid=$! +curl -f https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/firstboot.service > /etc/systemd/system/firstboot.service +mkdir -p /opt/confluent/bin +curl -f https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/firstboot.sh > /opt/confluent/bin/firstboot.sh +chmod +x /opt/confluent/bin/firstboot.sh + +run_remote post.custom +# post scripts may be placed into post.d, e.g. post.d/01-firstaction.sh, post.d/02-secondaction.sh +run_remote_parts post.d + +# Induce execution of remote configuration, e.g. ansible plays in ansible/post.d/ +run_remote_config post.d + +curl -sf -X POST -d 'status: staged' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $apikey" https://$confluent_mgr/confluent-api/self/updatestatus + +kill $logshowpid + diff --git a/confluent_server/confluent/core.py b/confluent_server/confluent/core.py index 711ef3ed..3a35eae4 100644 --- a/confluent_server/confluent/core.py +++ b/confluent_server/confluent/core.py @@ -266,6 +266,10 @@ def _init_core(): 'pluginattrs': ['hardwaremanagement.method'], 'default': 'ipmi', }), + 'location': PluginRoute({ + 'pluginattrs': ['hardwaremanagement.method'], + 'default': 'ipmi', + }), 'ntp': { 'enabled': PluginRoute({ 'pluginattrs': ['hardwaremanagement.method'], diff --git a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py index 09ec17e1..13df986e 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py @@ -509,6 +509,8 @@ class IpmiHandler(object): return self.handle_hostname() elif self.element[1:3] == ['management_controller', 'domain_name']: return self.handle_domain_name() + elif self.element[1:3] == ['management_controller', 'location']: + return self.handle_location_config() elif self.element[1:3] == ['management_controller', 'ntp']: return self.handle_ntp() elif self.element[1:4] == ['management_controller', 'extended', 'all']: @@ -1276,6 +1278,10 @@ class IpmiHandler(object): self.ipmicmd.set_domain_name(dn) return + def handle_location_config(self): + if 'read' == self.op: + lc = self.ipmicmd.get_location_information() + def handle_bmcconfig(self, advanced=False): if 'read' == self.op: try: