From fd714bc7bebf1caec1694d331b02bdd6c11774b1 Mon Sep 17 00:00:00 2001
From: Anders Blomdell <anders.blomdell@control.lth.se>
Date: Tue, 15 Aug 2017 17:36:57 +0200
Subject: [PATCH] Add comment on who generated ifcfg-*

---
 src/hostinfo/ifconfig.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/hostinfo/ifconfig.py b/src/hostinfo/ifconfig.py
index 28bdc18..c3bc2cd 100755
--- a/src/hostinfo/ifconfig.py
+++ b/src/hostinfo/ifconfig.py
@@ -2,6 +2,7 @@ import hostinfo.util as util
 import subprocess
 import re
 import ipaddr
+import sys
 
 def get_nm_extra(device):
     result = ""
@@ -222,7 +223,8 @@ def generate(tree, host):
             continue
         device_name = device(i.ethernet[0])
         if i.bridge[0]:
-            config = 'DEVICE=%s\n' % i.bridge[0]
+            config = '# Generated by %s\n' % (' '.join(sys.argv))
+            config += 'DEVICE=%s\n' % i.bridge[0]
             config += 'NAME="%s"\n' % i.bridge[0]
             config += 'ONBOOT=yes\n'
             config += 'TYPE=Bridge\n'
@@ -231,7 +233,8 @@ def generate(tree, host):
             config += generate_ifcfg(tree, i)
             result.append(('ifcfg-%s' %  i.bridge[0], config))
 
-            config = 'DEVICE=%s\n' % device_name
+            config = '# Generated by %s\n' % (' '.join(sys.argv))
+            config += 'DEVICE=%s\n' % device_name
             config += 'NAME="%s"\n' % device_name
             config += 'HWADDR=%s\n' % i.ethernet[0].upper()
             config += 'ONBOOT=yes\n'
@@ -241,7 +244,8 @@ def generate(tree, host):
             result.append(('ifcfg-%s' %  device_name, config))
             pass
         elif i.ethernet[0]:
-            config = 'DEVICE=%s\n' % device_name
+            config = '# Generated by %s\n' % (' '.join(sys.argv))
+            config += 'DEVICE=%s\n' % device_name
             config += 'NAME="%s"\n' % device_name
             config += 'HWADDR=%s\n' % i.ethernet[0].upper()
             config += 'ONBOOT=yes\n'
-- 
GitLab