Try new tag

This commit is contained in:
Johan Wassberg 2024-05-15 08:54:30 +02:00
parent 5d8b2d98a3
commit 652ab3d1bb
Signed by: jocar
GPG key ID: BE4EC2EEADF2C31B

View file

@ -6,6 +6,27 @@ import os
import os.path import os.path
import sys import sys
import socket
try:
fqdn = socket.getfqdn()
hostname = socket.gethostname()
except OSError:
host_info = None
else:
domainname = fqdn[len(hostname + ".") :]
environ = "test" if (domainname.find("test") != -1) else "prod"
customer = domainname.split(".")[0]
host_info = {
"customer": customer,
"domainname": domainname,
"environment": environ,
"fqdn": fqdn,
"hostname": hostname,
}
try: try:
from configobj import ConfigObj from configobj import ConfigObj
@ -94,6 +115,10 @@ def main():
if OS_INFO["VERSION_CODENAME"] == "bullseye": if OS_INFO["VERSION_CODENAME"] == "bullseye":
pass pass
if host_info:
if "internal-dco-prod-monitor-1" in host_info["fqdn"]:
modules["sunet"]["tag"] = "jocar-nrpe-scriptherder*"
# Build list of expected file content # Build list of expected file content
file_lines = create_file_content(modules) file_lines = create_file_content(modules)