Closed antonjrusso closed 7 years ago
This one should probably come after #91 as well as it adds a configuration parameter that is optional by nature, and we do not want to have to add this parameter all configuration in production for upgrading clara.
--- a/clara/plugins/clara_ipmi.py
+++ b/clara/plugins/clara_ipmi.py
@@ -111,7 +111,8 @@ def ipmi_do(hosts, *cmd):
pat = re.compile("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")
if not pat.match(host):
prefix = get_from_config("ipmi", "prefix")
- host = prefix + host
+ sufix = get_from_config("ipmi", "sufix")
+ host = prefix + host + sufix
ipmitool = ["ipmitool", "-I", "lanplus", "-H", host, "-U", imm_user, "-E", "-e!"]
ipmitool.extend(cmd)
@@ -134,7 +135,8 @@ def getmac(hosts):
pat = re.compile("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")
if not pat.match(host):
prefix = get_from_config("ipmi", "prefix")
- host = prefix + host
+ sufix = get_from_config("ipmi", "sufix")
+ host = prefix + host + sufix
logging.info("{0}: ".format(host))
cmd = ["ipmitool", "-I", "lanplus", "-H", host,
@@ -174,7 +176,8 @@ def do_connect_ipmi(host):
pat = re.compile("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")
if not pat.match(host):
prefix = get_from_config("ipmi", "prefix")
- host = prefix + host
+ sufix = get_from_config("ipmi", "sufix")
+ host = prefix + host + sufix
ipmitool = ["ipmitool", "-I", "lanplus", "-H", host, "-U", imm_user, "-E", "-e!", "sol", "activate"]
logging.debug("ipmi/ipmi_do: {0}".format(" ".join(ipmitool)))
@@ -223,7 +226,8 @@ def do_ping(hosts):
def do_ssh(hosts, command):
prefix = get_from_config("ipmi", "prefix")
- hosts = prefix + hosts
+ sufix = get_from_config("ipmi", "sufix")
+ hosts = prefix + hosts + sufix
os.environ["SSHPASS"] = \
value_from_file(get_from_config("common", "master_passwd_file"),