Hi list,

Here are the the fixes for https://fedorahosted.org/freeipa/ticket/5240
plus pep8-related fixes, plus created a user-friendly error message at import error.
obsoletes my previous patch

--
Oleg Fayans
Quality Engineer
FreeIPA team
RedHat.
From 61bef8f0f8377340deef136ae3125063d06458ce Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@redhat.com>
Date: Thu, 20 Aug 2015 15:45:55 +0200
Subject: [PATCH] Added a user-friendly output to an import error

---
 ipatests/test_integration/env_config.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ipatests/test_integration/env_config.py b/ipatests/test_integration/env_config.py
index c06334d9c3994938f60a9e4658b9004f09d49399..d16a3430d04968575583b84a945db4bc7f7b0e93 100644
--- a/ipatests/test_integration/env_config.py
+++ b/ipatests/test_integration/env_config.py
@@ -107,7 +107,11 @@ def get_global_config(env=None):
 
 def config_from_env(env):
     if 'IPATEST_YAML_CONFIG' in env:
-        import yaml
+        try:
+            import yaml
+        except ImportError as e:
+            raise ImportError("%s, please install PyYAML package to fix it" %
+                              e.message)
         with open(env['IPATEST_YAML_CONFIG']) as file:
             confdict = yaml.safe_load(file)
             return Config.from_dict(confdict)
-- 
2.4.3

From f1886d16869b0fe77be3827305ab103c80274c47 Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@redhat.com>
Date: Fri, 21 Aug 2015 10:39:56 +0200
Subject: [PATCH] Fixed pep8-related issues

---
 ipatests/test_integration/tasks.py | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 2b83f274619fcb18bcb87118d7df35a85ce52c1a..fb52f3e1e8fdef5bb6964f0647864a0695bc6307 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -70,7 +70,6 @@ def backup_file(host, filename):
         host.run_command('echo %s >> %s' % (
             ipautil.shell_quote(filename),
             ipautil.shell_quote(rmname)))
-        contents = host.get_file_contents(rmname)
         host.transport.mkdir_recursive(os.path.dirname(rmname))
         return False
 
@@ -118,9 +117,10 @@ def fix_apache_semaphores(master):
     if systemd_available:
         master.run_command(['systemctl', 'stop', 'httpd'], raiseonerr=False)
     else:
-        master.run_command([paths.SBIN_SERVICE, 'httpd', 'stop'], raiseonerr=False)
+        master.run_command([paths.SBIN_SERVICE, 'httpd', 'stop'],
+                           raiseonerr=False)
 
-    master.run_command('for line in `ipcs -s | grep apache | cut -d " " -f 2`; '
+    master.run_command('for line in `ipcs -s | grep apache | cut -d " " -f 2`;'
                        'do ipcrm -s $line; done', raiseonerr=False)
 
 
@@ -261,7 +261,7 @@ def install_client(master, client, extra_args=()):
                         '-p', client.config.admin_name,
                         '-w', client.config.admin_password,
                         '--server', master.hostname]
-                        + list(extra_args))
+                       + list(extra_args))
 
     setup_sssd_debugging(client)
     kinit_admin(client)
@@ -297,11 +297,9 @@ def install_adtrust(host):
         host.run_command(['systemctl', 'restart', 'named-pkcs11'])
     else:
         host.run_command(['systemctl', 'restart', 'named'])
-
-
     # Check that named is running and has loaded the information from LDAP
     dig_command = ['dig', 'SRV', '+short', '@localhost',
-               '_ldap._tcp.%s' % host.domain.name]
+                   '_ldap._tcp.%s' % host.domain.name]
     dig_output = '0 100 389 %s.' % host.hostname
     dig_test = lambda x: re.search(re.escape(dig_output), x)
 
@@ -373,9 +371,9 @@ def establish_trust_with_ad(master, ad, extra_args=()):
     master.run_command(['smbcontrol', 'all', 'debug', '100'])
     util.run_repeatedly(master,
                         ['ipa', 'trust-add',
-                        '--type', 'ad', ad.domain.name,
-                        '--admin', 'Administrator',
-                        '--password'] + list(extra_args),
+                         '--type', 'ad', ad.domain.name,
+                         '--admin', 'Administrator',
+                         '--password'] + list(extra_args),
                         stdin_text=master.config.ad_admin_password)
     master.run_command(['smbcontrol', 'all', 'debug', '1'])
     clear_sssd_cache(master)
@@ -428,16 +426,14 @@ def setup_sssd_debugging(host):
     # First, remove any previous occurences
     host.run_command(['sed', '-i',
                       '/debug_level = 7/d',
-                      paths.SSSD_CONF
-                     ], raiseonerr=False)
+                      paths.SSSD_CONF],
+                     raiseonerr=False)
 
     # Add the debug directive to each section
     host.run_command(['sed', '-i',
                       '/\[*\]/ a\debug_level = 7',
-                      paths.SSSD_CONF
-                     ], raiseonerr=False)
-
-
+                      paths.SSSD_CONF],
+                     raiseonerr=False)
     host.collect_log('/var/log/sssd/*')
 
     # Clear the cache and restart SSSD
@@ -492,7 +488,7 @@ def disconnect_replica(master, replica):
 
 def kinit_admin(host):
     host.run_command(['kinit', 'admin'],
-                      stdin_text=host.config.admin_password)
+                     stdin_text=host.config.admin_password)
 
 
 def uninstall_master(host):
@@ -508,7 +504,7 @@ def uninstall_master(host):
                       paths.SYSCONFIG_PKI_TOMCAT_PKI_TOMCAT_DIR,
                       paths.VAR_LIB_PKI_TOMCAT_DIR,
                       paths.PKI_TOMCAT],
-                      raiseonerr=False)
+                     raiseonerr=False)
     unapply_fixes(host)
 
 
@@ -668,7 +664,6 @@ def install_clients(servers, clients):
 
 def _entries_to_ldif(entries):
     """Format LDAP entries as LDIF"""
-    lines = []
     io = StringIO.StringIO()
     writer = LDIFWriter(io)
     for entry in entries:
-- 
2.4.3

From abf3b6702594c88ca950a408696f94e794b25229 Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@redhat.com>
Date: Fri, 21 Aug 2015 10:44:17 +0200
Subject: [PATCH] Temporary fix for ticket 5240

---
 ipatests/test_integration/tasks.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index fb52f3e1e8fdef5bb6964f0647864a0695bc6307..9ac66575fbad13c77b66e4b913a6d90c54f55000 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -223,14 +223,14 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False):
 
     master.run_command(['ipa-replica-prepare',
                         '-p', replica.config.dirman_password,
-                        '--ip-address', replica.ip,
+                        '--ip-address', replica.ip, '--no-reverse',
                         replica.hostname])
     replica_bundle = master.get_file_contents(
         paths.REPLICA_INFO_GPG_TEMPLATE % replica.hostname)
     replica_filename = os.path.join(replica.config.test_dir,
                                     'replica-info.gpg')
     replica.put_file_contents(replica_filename, replica_bundle)
-    args = ['ipa-replica-install', '-U',
+    args = ['ipa-replica-install', '-U', '--no-host-dns',
             '-p', replica.config.dirman_password,
             '-w', replica.config.admin_password,
             '--ip-address', replica.ip,
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to