summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannik Schönartz2021-05-25 16:10:09 +0200
committerJannik Schönartz2021-05-25 16:10:09 +0200
commitacb0090159d088e816ee97fa10bb74d5d2da562c (patch)
treef94613881b3fbdeeae96e861ff835c6c4ec7528f
parent[bas-python] Add newer lspci version to the minilinux, handle busybox lspci v... (diff)
downloadsystemd-init-acb0090159d088e816ee97fa10bb74d5d2da562c.tar.gz
systemd-init-acb0090159d088e816ee97fa10bb74d5d2da562c.tar.xz
systemd-init-acb0090159d088e816ee97fa10bb74d5d2da562c.zip
[bas-python] Add optional contact information argument (first-/lastname)
-rwxr-xr-xmodules.d/bas-python/scripts/collect_hw_info_json.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/modules.d/bas-python/scripts/collect_hw_info_json.py b/modules.d/bas-python/scripts/collect_hw_info_json.py
index 5341279a..d52a9ad2 100755
--- a/modules.d/bas-python/scripts/collect_hw_info_json.py
+++ b/modules.d/bas-python/scripts/collect_hw_info_json.py
@@ -188,6 +188,18 @@ def prepare_location(parent, rack, bay, slot):
location['slot'] = slot
return location
+def prepare_contacts(contact_list):
+ contacts = []
+ if contact_list == None:
+ return contacts
+ print(str(contact_list))
+ for contact in contact_list:
+ contacts.append({
+ 'firstname': contact[0],
+ 'lastname': contact[1],
+ })
+ return contacts
+
def send_post(url, payload):
headers = { 'Content-type': 'application/json', 'Accept': 'text/plain' }
# req = requests.post(url, json=payload, headers=headers)
@@ -207,6 +219,7 @@ def main():
parser.add_argument('-s', '--slot', action='store', help='<slot>')
parser.add_argument('-b', '--bay', action='store', help='<bay>')
parser.add_argument('-l', '--location', action='store', help='<location>: Roomname where the client is located')
+ parser.add_argument('-c', '--contact', action='append', help='<contact>: <firstname> <lastname> of the person responsible for this machine', nargs=2)
args = parser.parse_args()
if args.debug:
@@ -223,6 +236,7 @@ def main():
_collecthw['lshw'] = get_lshw()
_collecthw['net'] = get_net_fallback()
_collecthw['location'] = prepare_location(args.location, args.rack, args.bay, args.slot)
+ _collecthw['contacts'] = prepare_contacts(args.contact)
collecthw_json = json.dumps(_collecthw)
if (args.url):