[test-API 03/17] Rename src/env_parser.py as src/global_parser.py

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



And:

% for i in $(grep 'envparser' * -r | awk -F':' '{print $1}' | uniq); do \
    sed -i -e 's/envparser/global_parser/g' $i; \
  done

% for i in $(grep 'Envparser' * -r | awk -F':' '{print $1}' | uniq); do \
    sed -i -e 's/Envparser/GlobalParser/g' $i; \
  done

% for i in $(grep 'env_parser' * -r | awk -F':' '{print $1}' | uniq); do \
    sed -i -e 's/envparser/GlobalParser/g' $i; \
  done

Typo fixes:

% for i in $(grep 'Envpaser' * -r | awk -F':' '{print $1}' | uniq); do \
    sed -i -e 's/Envpaser/GlobalParser/g' $i; \
  done
---
 .../en-US/Understanding_libvirt-test-API.xml       |    2 +-
 .../en-US/Writing_a_test_case.xml                  |   16 ++++++++--------
 repos/domain/install_image.py                      |    6 +++---
 repos/domain/install_linux_cdrom.py                |    8 ++++----
 repos/domain/install_linux_check.py                |    6 +++---
 repos/domain/install_linux_net.py                  |   12 ++++++------
 repos/domain/install_windows_cdrom.py              |   12 ++++++------
 .../multiple_thread_block_on_domain_create.py      |    8 ++++----
 src/env_inspect.py                                 |   14 +++++++-------
 src/generator.py                                   |    4 ++--
 src/{env_parser.py => global_parser.py}            |    4 ++--
 src/parser.py                                      |    4 ++--
 12 files changed, 48 insertions(+), 48 deletions(-)
 rename src/{env_parser.py => global_parser.py} (97%)

diff --git a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
index 88c1b76..a563953 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
@@ -206,7 +206,7 @@ repos
           <para>Random MAC address generator. Useful when installing a guest machine.</para>
         </listitem>
         <listitem>
-          <para><filename>env_parser.py</filename> is the parser component of the environment INI file.</para>
+          <para><filename>global_parser.py</filename> is the parser component of the environment INI file.</para>
         </listitem>
         <listitem>
           <para><filename>check.py</filename> verifies if a hypervisor is running.</para>
diff --git a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
index 2a74518..b36c660 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
@@ -141,7 +141,7 @@ sys.path.append(rootdir)
 import exception
 from lib import connectAPI
 from lib import storageAPI
-from utils import env_parser
+from utils import global_parser
 from utils import xml_builder
 
 envfile = 'env.ini'
@@ -149,9 +149,9 @@ envfile = 'env.ini'
 def initialize_storage(dict):
     logger = dict['logger']
     dict['hypertype'] = 'xen'
-    envparser = env_parser.Envpaser(envfile)
-    dict['sourcename'] = envparser.get_value('storage', 'sourcename')
-    dict['sourcepath'] = envparser.get_value('storage', 'sourcepath')
+    global_parser = global_parser.GlobalParser(envfile)
+    dict['sourcename'] = global_parser.get_value('storage', 'sourcename')
+    dict['sourcepath'] = global_parser.get_value('storage', 'sourcepath')
 
     logger.info('prepare create storage pool')
     xmlobj = xml_builder.XmlBuilder()
@@ -200,7 +200,7 @@ sys.path.append(rootdir)
 import exception
 from lib import connectAPI
 from lib import domainAPI
-from utils import env_parser
+from utils import global_parser
 from utils import xml_builder
 
 envfile = 'env.ini'
@@ -237,9 +237,9 @@ def install_guest(dict):
     dict['bootcd'] = '/tmp/%s/custom.iso' %gname
 
     logger.info('get system environment information')
-    envparser = env_parser.Envpaser(envfile)
-    url = envparser.get_value("guest", gname + "src")
-    dict['kickstart'] = envparser.get_value("guest", gname + "ks")
+    global_parser = global_parser.GlobalParser(envfile)
+    url = global_parser.get_value("guest", gname + "src")
+    dict['kickstart'] = global_parser.get_value("guest", gname + "ks")
     logger.debug('install source: \n    %s' %url)
     logger.debug('kisckstart file: \n    %s' %dict['kickstart'])
 
diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
index e94ebc7..84df56d 100644
--- a/repos/domain/install_image.py
+++ b/repos/domain/install_image.py
@@ -11,7 +11,7 @@ import libvirt
 from libvirt import libvirtError
 
 from src import sharedmod
-from src import env_parser
+from src import global_parser
 from utils import utils
 from utils import xml_builder
 
@@ -63,8 +63,8 @@ def install_image(params):
     envfile = os.path.join(HOME_PATH, 'global.cfg')
     logger.info("the environment file is %s" % envfile)
 
-    envparser = env_parser.Envparser(envfile)
-    image_url = envparser.get_value("image", "%s_%s" % (guestos, guestarch))
+    global_parser = global_parser.GlobalParser(envfile)
+    image_url = global_parser.get_value("image", "%s_%s" % (guestos, guestarch))
 
     logger.info("download images file from %s" % image_url)
     urllib.urlretrieve(image_url, imgfullpath)
diff --git a/repos/domain/install_linux_cdrom.py b/repos/domain/install_linux_cdrom.py
index 7f0019e..59ef5d7 100644
--- a/repos/domain/install_linux_cdrom.py
+++ b/repos/domain/install_linux_cdrom.py
@@ -14,7 +14,7 @@ import libvirt
 from libvirt import libvirtError
 
 from src import sharedmod
-from src import env_parser
+from src import global_parser
 from utils import utils
 from utils import xml_builder
 
@@ -226,9 +226,9 @@ def install_linux_cdrom(params):
     envfile = os.path.join(HOME_PATH, 'global.cfg')
     logger.info("the environment file is %s" % envfile)
 
-    envparser = env_parser.Envparser(envfile)
-    ostree = envparser.get_value("guest", guestos + "_" +guestarch)
-    ks = envparser.get_value("guest", guestos + "_" +guestarch + "_http_ks")
+    global_parser = global_parser.GlobalParser(envfile)
+    ostree = global_parser.get_value("guest", guestos + "_" +guestarch)
+    ks = global_parser.get_value("guest", guestos + "_" +guestarch + "_http_ks")
 
     logger.debug('install source: \n    %s' % ostree)
     logger.debug('kisckstart file: \n    %s' % ks)
diff --git a/repos/domain/install_linux_check.py b/repos/domain/install_linux_check.py
index 74b8819..c5ee2d8 100644
--- a/repos/domain/install_linux_check.py
+++ b/repos/domain/install_linux_check.py
@@ -12,7 +12,7 @@ import libvirt
 from libvirt import libvirtError
 
 from src import sharedmod
-from src import env_parser
+from src import global_parser
 from utils import utils
 
 required_params = ('guestname', 'virt_type', 'hdmodel', 'nicmodel',)
@@ -151,8 +151,8 @@ def install_linux_check(params):
     envfile = os.path.join(HOME_PATH, 'global.cfg')
     logger.info("the environment file is %s" % envfile)
 
-    envparser = env_parser.Envparser(envfile)
-    file_url = envparser.get_value("other", "wget_url")
+    global_parser = global_parser.GlobalParser(envfile)
+    file_url = global_parser.get_value("other", "wget_url")
 
     if utils.run_wget_app(ipaddr, "root", "redhat", file_url, logger) == 0:
         logger.info("run wget successfully in guest.")
diff --git a/repos/domain/install_linux_net.py b/repos/domain/install_linux_net.py
index de8ff0a..ae97137 100644
--- a/repos/domain/install_linux_net.py
+++ b/repos/domain/install_linux_net.py
@@ -14,7 +14,7 @@ import libvirt
 from libvirt import libvirtError
 
 from src import sharedmod
-from src import env_parser
+from src import global_parser
 from utils import utils
 from utils import xml_builder
 
@@ -191,20 +191,20 @@ def install_linux_net(params):
     envfile = os.path.join(HOME_PATH, 'global.cfg')
     logger.info("the environment file is %s" % envfile)
 
-    envparser = env_parser.Envparser(envfile)
+    global_parser = global_parser.GlobalParser(envfile)
 
     # Get http, ftp or nfs url based on guest os, arch
     # and installation method from global.cfg
 
     if installmethod == 'http':
-        ks = envparser.get_value("guest", guestos + "_" + guestarch +
+        ks = global_parser.get_value("guest", guestos + "_" + guestarch +
                                 "_http_ks")
     elif installmethod == 'ftp':
-        ks = envparser.get_value("guest", guestos + "_" + guestarch + "_ftp_ks")
+        ks = global_parser.get_value("guest", guestos + "_" + guestarch + "_ftp_ks")
     elif installmethod == "nfs":
-        ks = envparser.get_value("guest", guestos + "_" + guestarch + "_nfs_ks")
+        ks = global_parser.get_value("guest", guestos + "_" + guestarch + "_nfs_ks")
 
-    ostree = envparser.get_value("guest", guestos + "_" + guestarch)
+    ostree = global_parser.get_value("guest", guestos + "_" + guestarch)
 
     logger.debug('install source: \n    %s' % ostree)
     logger.debug('kisckstart file: \n    %s' % ks)
diff --git a/repos/domain/install_windows_cdrom.py b/repos/domain/install_windows_cdrom.py
index d87935f..8344447 100644
--- a/repos/domain/install_windows_cdrom.py
+++ b/repos/domain/install_windows_cdrom.py
@@ -13,7 +13,7 @@ import libvirt
 from libvirt import libvirtError
 
 from src import sharedmod
-from src import env_parser
+from src import global_parser
 from utils import utils
 from utils import xml_builder
 
@@ -260,9 +260,9 @@ def install_windows_cdrom(params):
     logger.info("the environment file is %s" % envfile)
 
     # Get iso file based on guest os and arch from global.cfg
-    envparser = env_parser.Envparser(envfile)
-    iso_file = envparser.get_value("guest", guestos + '_' + guestarch)
-    cdkey = envparser.get_value("guest", "%s_%s_key" % (guestos, guestarch))
+    global_parser = global_parser.GlobalParser(envfile)
+    iso_file = global_parser.get_value("guest", guestos + '_' + guestarch)
+    cdkey = global_parser.get_value("guest", "%s_%s_key" % (guestos, guestarch))
 
     windows_unattended_path = os.path.join(HOME_PATH,
                               "repos/domain/windows_unattended")
@@ -428,8 +428,8 @@ def install_windows_cdrom_clean(params):
     guestarch = params.get('guestarch')
 
     envfile = os.path.join(HOME_PATH, 'global.cfg')
-    envparser = env_parser.Envparser(envfile)
-    iso_file = envparser.get_value("guest", guestos + '_' + guestarch)
+    global_parser = global_parser.GlobalParser(envfile)
+    iso_file = global_parser.get_value("guest", guestos + '_' + guestarch)
 
     status, iso_local_path = prepare_iso(iso_file, ISO_MOUNT_POINT)
     if os.path.exists(iso_local_path):
diff --git a/repos/regression/multiple_thread_block_on_domain_create.py b/repos/regression/multiple_thread_block_on_domain_create.py
index 180736a..ac7a165 100644
--- a/repos/regression/multiple_thread_block_on_domain_create.py
+++ b/repos/regression/multiple_thread_block_on_domain_create.py
@@ -15,7 +15,7 @@ from libvirt import libvirtError
 
 from src import sharedmod
 from utils import utils
-from utils import env_parser
+from utils import global_parser
 from utils import xml_builder
 
 IMAG_PATH = "/var/lib/libvirt/images/"
@@ -117,9 +117,9 @@ def multiple_thread_block_on_domain_create(params):
     logger.debug("the uri to connect is %s" % uri)
 
     envfile = os.path.join(homepath, 'global.cfg')
-    envparser = env_parser.Envpaser(envfile)
-    ostree = envparser.get_value("guest", guestos + "_" + arch)
-    ks = envparser.get_value("guest", guestos + "_" + arch +
+    global_parser = global_parser.GlobalParser(envfile)
+    ostree = global_parser.get_value("guest", guestos + "_" + arch)
+    ks = global_parser.get_value("guest", guestos + "_" + arch +
                                 "_http_ks")
 
     # download vmlinuz and initrd.img
diff --git a/src/env_inspect.py b/src/env_inspect.py
index 4942b33..05bfec1 100644
--- a/src/env_inspect.py
+++ b/src/env_inspect.py
@@ -82,13 +82,13 @@ def request_credentials(credentials, user_data):
 
     return 0
 
-def sharemod_init(env_parser, logger):
+def sharemod_init(global_parser, logger):
     """ get connection object from libvirt module
         initialize sharemod for use by testcases
     """
-    uri = env_parser.get_value('variables', 'defaulturi')
-    username = env_parser.get_value('variables', 'username')
-    password = env_parser.get_value('variables', 'password')
+    uri = global_parser.get_value('variables', 'defaulturi')
+    username = global_parser.get_value('variables', 'username')
+    password = global_parser.get_value('variables', 'password')
     user_data = [username, password]
     auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE], request_credentials, user_data]
     conn = libvirt.openAuth(uri, auth, 0)
@@ -107,9 +107,9 @@ class EnvInspect(object):
        before performing testing
     """
 
-    def __init__(self, env_parser, logger):
+    def __init__(self, global_parser, logger):
         self.logger = logger
-        self.env_parser = env_parser
+        self.global_parser = global_parser
 
     def env_checking(self):
         if hostinfo(self.logger):
@@ -118,7 +118,7 @@ class EnvInspect(object):
         if check_libvirt(self.logger):
             return 1
 
-        if sharemod_init(self.env_parser, self.logger):
+        if sharemod_init(self.global_parser, self.logger):
             return 1
 
         return 0
diff --git a/src/generator.py b/src/generator.py
index fc6cec3..2ca3429 100644
--- a/src/generator.py
+++ b/src/generator.py
@@ -25,7 +25,7 @@ import os
 import traceback
 
 from src import mapper
-from src import env_parser
+from src import global_parser
 from src import env_inspect
 from utils import log
 from utils import format
@@ -52,7 +52,7 @@ class FuncGen(object):
         # Save case information to a file in a format
         self.__case_info_save(activity, testrunid)
 
-        self.env = env_parser.Envparser("global.cfg")
+        self.env = global_parser.GlobalParser("global.cfg")
 
         mapper_obj = mapper.Mapper(activity)
         case_list = mapper_obj.module_casename_func_map()
diff --git a/src/env_parser.py b/src/global_parser.py
similarity index 97%
rename from src/env_parser.py
rename to src/global_parser.py
index cf4168f..19b50ab 100644
--- a/src/env_parser.py
+++ b/src/global_parser.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# env_parser.py: Parser for environment config (global.cfg).
+# global_parser.py: Parser for environment config (global.cfg).
 #
 # Copyright (C) 2010-2012 Red Hat, Inc.
 #
@@ -27,7 +27,7 @@ sys.path.append(os.path.split(absdir)[0])
 
 from src import exception
 
-class Envparser(object):
+class GlobalParser(object):
     def __init__(self, configfile):
         self.cfg = ConfigParser.ConfigParser()
         if os.path.isfile(configfile):
diff --git a/src/parser.py b/src/parser.py
index 8a861fd..46a28fd 100644
--- a/src/parser.py
+++ b/src/parser.py
@@ -24,7 +24,7 @@ import copy
 import string
 
 from src import exception
-from src import env_parser
+from src import global_parser
 
 class CaseFileParser(object):
     """ Parser the case configuration file to generate a data list.
@@ -35,7 +35,7 @@ class CaseFileParser(object):
         self.missing_variables = []
         self.debug = debug
         self.casefile = casefile
-        self.env = env_parser.Envparser("global.cfg")
+        self.env = global_parser.GlobalParser("global.cfg")
         self.loop_finish = False
         self.loop_start = 0
         self.loop_end = 0
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]