[lnst] Common: New module NetUtils
Jiří Pírko
jirka at fedoraproject.org
Mon Aug 13 11:37:14 UTC 2012
commit 7402d6ca1fa19b69d2eca7b15ad026f5209f1ea8
Author: Radek Pazdera <rpazdera at redhat.com>
Date: Mon Aug 13 12:01:43 2012 +0200
Common: New module NetUtils
Created a new module for networking related code and utilities
in Common package.
The normalize_hwaddr() function was moved there.
Signed-off-by: Radek Pazdera <rpazdera at redhat.com>
Common/NetUtils.py | 16 ++++++++++++++++
NetConfig/NetConfigDevNames.py | 4 +---
NetTest/NetTestParse.py | 3 +--
3 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/Common/NetUtils.py b/Common/NetUtils.py
new file mode 100644
index 0000000..059ce6e
--- /dev/null
+++ b/Common/NetUtils.py
@@ -0,0 +1,16 @@
+"""
+Networking related utilities and common code
+
+Copyright 2012 Red Hat, Inc.
+Licensed under the GNU General Public License, version 2 as
+published by the Free Software Foundation; see COPYING for details.
+"""
+
+__author__ = """
+rpazdera at redhat.com (Radek Pazdera)
+"""
+
+import logging
+
+def normalize_hwaddr(hwaddr):
+ return hwaddr.upper().rstrip("\n")
diff --git a/NetConfig/NetConfigDevNames.py b/NetConfig/NetConfigDevNames.py
index 1220480..7c7f862 100644
--- a/NetConfig/NetConfigDevNames.py
+++ b/NetConfig/NetConfigDevNames.py
@@ -13,9 +13,7 @@ jpirko at redhat.com (Jiri Pirko)
import logging
import os
from NetConfigCommon import get_option
-
-def normalize_hwaddr(hwaddr):
- return hwaddr.upper().rstrip("\n")
+from Common.NetUtils import normalize_hwaddr
class NetConfigDevNames:
def __init__(self):
diff --git a/NetTest/NetTestParse.py b/NetTest/NetTestParse.py
index 32d75e1..746342c 100644
--- a/NetTest/NetTestParse.py
+++ b/NetTest/NetTestParse.py
@@ -16,8 +16,7 @@ import re
from Common.XmlProcessing import RecipeParser
from Common.XmlProcessing import XmlDomTreeInit
from Common.XmlProcessing import XmlProcessingError
-from NetConfig.NetConfigDevNames import normalize_hwaddr
-
+from Common.NetUtils import normalize_hwaddr
class NetTestParse(RecipeParser):
def __init__(self, recipe_filepath):
More information about the LNST-developers
mailing list