Support form mac address lookup

This commit is contained in:
Lukáš Plevač 2024-12-08 17:56:40 +01:00
parent b85ddb0a2a
commit d6ca2b6d15
2 changed files with 28 additions and 3 deletions

View File

@ -1,6 +1,6 @@
pkgname=saturn-discover
pkgver=1.2
pkgrel=3
pkgver=1.3
pkgrel=4
arch=('any')
source=('saturnDiscoverDeamon.py' 'saturnDiscover.service' 'saturnDiscover')
md5sums=('SKIP' 'SKIP' 'SKIP')

View File

@ -41,6 +41,7 @@ def help():
print(" list List values (from list)")
print(" get Get value")
print(" reload Reload cluster config")
print(" lookup Lookup for value in list")
print("")
print("Every command have sub help, when you write help in ops")
@ -77,6 +78,14 @@ def helpGet():
print("supported tragets:")
print(" mac Node mac address")
def helpLookup():
print("Saturn discover setting tool")
print("command LOOKUP - get value from list")
print()
print("Using: saturnDiscover lookup <targetList> <tragetRow>")
print("supported tragetsList:")
print(" hostmac Node mac address lookup by hostname or ip address")
def helpReload():
print("Saturn discover setting tool")
print("command RELOAD - reload cluster configuration on all nodes")
@ -133,7 +142,23 @@ elif (sys.argv[1] == "get"):
if (sys.argv[2] == "mac"):
print(tryReadFile("/etc/slurm-llnl/localMac", "00:00:00:00:00:00"))
elif (sys.argv[1] == "reaload"):
elif (sys.argv[1] == "lookup"):
if (argc != 4):
helpLookup()
exit(1)
if (sys.argv[2] == "hostmac"):
nodes = loadHosts()
for node in nodes:
if node["ip"] == sys.argv[3] or node["name"] == sys.argv[3]:
print(node["mac"])
exit(0)
print("00:00:00:00:00:00")
elif (sys.argv[1] == "reload"):
if (argc != 2):
helpReload()
exit(1)