Hello community,
here is the log from the commit of package python3-img-proof for
openSUSE:Factory checked in at 2020-06-22 17:46:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-img-proof (Old)
and /work/SRC/openSUSE:Factory/.python3-img-proof.new.2956 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-img-proof"
Mon Jun 22 17:46:50 2020 rev:11 rq:816376 version:5.2.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-img-proof/python3-img-proof.changes
2020-06-16 13:45:49.677840496 +0200
+++
/work/SRC/openSUSE:Factory/.python3-img-proof.new.2956/python3-img-proof.changes
2020-06-22 17:46:50.798024067 +0200
@@ -1,0 +2,8 @@
+Fri Jun 19 21:29:50 UTC 2020 - Sean Marlow <[email protected]>
+
+- Update to v5.2.0 (2020-06-19)
+ + Add arg in API to provide logger instance.
+ + Remove file handler for logging which causes message duplication.
+ + Add Red Hat family distro module and Fedora distro module.
+
+-------------------------------------------------------------------
Old:
----
img-proof-5.1.0.tar.gz
New:
----
img-proof-5.2.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python3-img-proof.spec ++++++
--- /var/tmp/diff_new_pack.BqqV7H/_old 2020-06-22 17:46:51.294025623 +0200
+++ /var/tmp/diff_new_pack.BqqV7H/_new 2020-06-22 17:46:51.298025636 +0200
@@ -18,7 +18,7 @@
%bcond_without test
Name: python3-img-proof
-Version: 5.1.0
+Version: 5.2.0
Release: 0
Summary: Command line and API for testing custom images
License: GPL-3.0-or-later
++++++ img-proof-5.1.0.tar.gz -> img-proof-5.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/CHANGES.md
new/img-proof-5.2.0/CHANGES.md
--- old/img-proof-5.1.0/CHANGES.md 2020-06-01 22:49:26.000000000 +0200
+++ new/img-proof-5.2.0/CHANGES.md 2020-06-07 21:09:18.000000000 +0200
@@ -1,3 +1,13 @@
+v5.2.0 (2020-06-07)
+===================
+
+- Allow any calls to API to provide their own logger instance.
+ [\#250](https://github.com/SUSE-Enceladus/ipa/pull/250)
+- Remove file handler for logging which causes message duplication.
+ [\#251](https://github.com/SUSE-Enceladus/ipa/pull/251)
+- Add Red Hat family distro module and Fedora distro module.
+ [\#252](https://github.com/SUSE-Enceladus/ipa/pull/252)
+
v5.1.0 (2020-06-01)
===================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/PKG-INFO new/img-proof-5.2.0/PKG-INFO
--- old/img-proof-5.1.0/PKG-INFO 2020-06-01 22:50:19.000000000 +0200
+++ new/img-proof-5.2.0/PKG-INFO 2020-06-07 21:10:09.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: img-proof
-Version: 5.1.0
+Version: 5.2.0
Summary: Package for automated testing of cloud images.
Home-page: https://github.com/SUSE-Enceladus/img-proof
Author: SUSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/__init__.py
new/img-proof-5.2.0/img_proof/__init__.py
--- old/img-proof-5.1.0/img_proof/__init__.py 2020-06-01 22:49:26.000000000
+0200
+++ new/img-proof-5.2.0/img_proof/__init__.py 2020-06-07 21:09:18.000000000
+0200
@@ -22,4 +22,4 @@
__author__ = """SUSE"""
__email__ = '[email protected]'
-__version__ = '5.1.0'
+__version__ = '5.2.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/ipa_azure.py
new/img-proof-5.2.0/img_proof/ipa_azure.py
--- old/img-proof-5.1.0/img_proof/ipa_azure.py 2020-06-01 22:49:26.000000000
+0200
+++ new/img-proof-5.2.0/img_proof/ipa_azure.py 2020-06-07 21:09:18.000000000
+0200
@@ -2,7 +2,7 @@
"""Module for testing instances in Azure."""
-# Copyright (c) 2019 SUSE LLC. All rights reserved.
+# Copyright (c) 2020 SUSE LLC. All rights reserved.
#
# This file is part of img_proof. img_proof provides an api and command line
# utilities for testing images in the Public Cloud.
@@ -65,7 +65,8 @@
vnet_resource_group=None,
collect_vm_info=None,
enable_secure_boot=None,
- enable_uefi=None
+ enable_uefi=None,
+ log_callback=None
):
"""Initialize Azure Cloud class."""
super(AzureCloud, self).__init__(
@@ -93,7 +94,8 @@
ssh_user,
subnet_id,
enable_secure_boot,
- enable_uefi
+ enable_uefi,
+ log_callback
)
self.vnet_name = vnet_name or self.ipa_config['vnet_name']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/ipa_cloud.py
new/img-proof-5.2.0/img_proof/ipa_cloud.py
--- old/img-proof-5.1.0/img_proof/ipa_cloud.py 2020-06-01 22:49:26.000000000
+0200
+++ new/img-proof-5.2.0/img_proof/ipa_cloud.py 2020-06-07 21:09:18.000000000
+0200
@@ -40,6 +40,8 @@
NOT_IMPLEMENTED,
TEST_PATHS
)
+from img_proof.ipa_rhel import RHEL
+from img_proof.ipa_fedora import Fedora
from img_proof.ipa_opensuse_leap import openSUSE_Leap
from img_proof.ipa_sles import SLES
from img_proof.ipa_exceptions import (
@@ -95,7 +97,8 @@
ssh_user=None,
subnet_id=None,
enable_secure_boot=None,
- enable_uefi=None
+ enable_uefi=None,
+ log_callback=None
):
"""Initialize base cloud framework class."""
super(IpaCloud, self).__init__()
@@ -111,14 +114,12 @@
self.config = config or default_values['config']
log_level = log_level or default_values['log_level']
- self.logger = logging.getLogger('img_proof')
- self.logger.setLevel(log_level)
-
- console_handler = logging.StreamHandler()
- console_handler.setLevel(log_level)
- console_handler.setFormatter(logging.Formatter('%(message)s'))
-
- self.logger.addHandler(console_handler)
+ if log_callback:
+ self.logger = log_callback
+ else:
+ self.logger = logging.getLogger('img_proof')
+ self.logger.setLevel(log_level)
+ self.logger.propagate = False
try:
self.ipa_config = ipa_utils.get_config_values(
@@ -377,10 +378,14 @@
def _set_distro(self):
"""Determine distro for image and create instance of class."""
- if self.distro_name == 'sles':
- self.distro = SLES()
+ if self.distro_name == 'fedora':
+ self.distro = Fedora()
elif self.distro_name == 'opensuse_leap':
self.distro = openSUSE_Leap()
+ elif self.distro_name == 'rhel':
+ self.distro = RHEL()
+ elif self.distro_name == 'sles':
+ self.distro = SLES()
else:
raise IpaCloudException(
'Distribution: %s, not supported.' % self.distro_name
@@ -427,14 +432,6 @@
)
self.logger.debug('Created results file %s' % self.results_file)
- # Add log file handler
- file_handler = logging.FileHandler(self.log_file)
- file_handler.setLevel(logging.DEBUG)
- file_handler.setFormatter(
- logging.Formatter('\n%(asctime)s: %(message)s\n')
- )
- self.logger.addHandler(file_handler)
-
def _start_instance(self):
"""Start the instance."""
raise NotImplementedError(NOT_IMPLEMENTED)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/ipa_controller.py
new/img-proof-5.2.0/img_proof/ipa_controller.py
--- old/img-proof-5.1.0/img_proof/ipa_controller.py 2020-06-01
22:49:26.000000000 +0200
+++ new/img-proof-5.2.0/img_proof/ipa_controller.py 2020-06-07
21:09:18.000000000 +0200
@@ -2,7 +2,7 @@
"""Controller class for img_proof endpoints."""
-# Copyright (c) 2019 SUSE LLC. All rights reserved.
+# Copyright (c) 2020 SUSE LLC. All rights reserved.
#
# This file is part of img_proof. img_proof provides an api and command line
# utilities for testing images in the Public Cloud.
@@ -78,7 +78,8 @@
tenancy=None,
oci_user_id=None,
enable_secure_boot=None,
- enable_uefi=None
+ enable_uefi=None,
+ log_callback=None
):
"""Creates a cloud framework instance and initiates testing."""
kwargs = {
@@ -105,7 +106,8 @@
'timeout': timeout,
'collect_vm_info': collect_vm_info,
'enable_secure_boot': enable_secure_boot,
- 'enable_uefi': enable_uefi
+ 'enable_uefi': enable_uefi,
+ 'log_callback': log_callback
}
cloud_name = cloud_name.lower()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/ipa_ec2.py
new/img-proof-5.2.0/img_proof/ipa_ec2.py
--- old/img-proof-5.1.0/img_proof/ipa_ec2.py 2020-06-01 22:49:26.000000000
+0200
+++ new/img-proof-5.2.0/img_proof/ipa_ec2.py 2020-06-07 21:09:18.000000000
+0200
@@ -2,7 +2,7 @@
"""Cloud framework module for testing AWS EC2 images."""
-# Copyright (c) 2019 SUSE LLC. All rights reserved.
+# Copyright (c) 2020 SUSE LLC. All rights reserved.
#
# This file is part of img_proof. img_proof provides an api and command line
# utilities for testing images in the Public Cloud.
@@ -69,7 +69,8 @@
timeout=None,
collect_vm_info=None,
enable_secure_boot=None,
- enable_uefi=None
+ enable_uefi=None,
+ log_callback=None
):
"""Initialize EC2 cloud framework class."""
super(EC2Cloud, self).__init__(
@@ -97,7 +98,8 @@
ssh_user,
subnet_id,
enable_secure_boot,
- enable_uefi
+ enable_uefi,
+ log_callback
)
# Get command line values that are not None
cmd_line_values = self._get_non_null_values(locals())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/ipa_exceptions.py
new/img-proof-5.2.0/img_proof/ipa_exceptions.py
--- old/img-proof-5.1.0/img_proof/ipa_exceptions.py 2020-06-01
22:49:26.000000000 +0200
+++ new/img-proof-5.2.0/img_proof/ipa_exceptions.py 2020-06-07
21:09:18.000000000 +0200
@@ -65,6 +65,10 @@
"""Results subcommand exception."""
+class IpaRedHatException(IpaDistroException):
+ """Generic Exception for Red Hat distro modules."""
+
+
class IpaSLESException(IpaDistroException):
"""Generic Exception for distro modules."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/ipa_fedora.py
new/img-proof-5.2.0/img_proof/ipa_fedora.py
--- old/img-proof-5.1.0/img_proof/ipa_fedora.py 1970-01-01 01:00:00.000000000
+0100
+++ new/img-proof-5.2.0/img_proof/ipa_fedora.py 2020-06-07 21:09:18.000000000
+0200
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+"""Fedora distro module and sync points."""
+
+# Copyright (c) 2020 Neal Gompa. All rights reserved.
+#
+# This file is part of img_proof. img_proof provides an api and command line
+# utilities for testing images in the Public Cloud.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from img_proof.ipa_redhat import RedHat
+
+
+class Fedora(RedHat):
+ """Fedora distro class."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/ipa_gce.py
new/img-proof-5.2.0/img_proof/ipa_gce.py
--- old/img-proof-5.1.0/img_proof/ipa_gce.py 2020-06-01 22:49:26.000000000
+0200
+++ new/img-proof-5.2.0/img_proof/ipa_gce.py 2020-06-07 21:09:18.000000000
+0200
@@ -109,7 +109,8 @@
collect_vm_info=None,
image_project=None,
enable_secure_boot=None,
- enable_uefi=None
+ enable_uefi=None,
+ log_callback=None
):
super(GCECloud, self).__init__(
'gce',
@@ -136,7 +137,8 @@
ssh_user,
subnet_id,
enable_secure_boot,
- enable_uefi
+ enable_uefi,
+ log_callback
)
self.service_account_file = (
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/ipa_oci.py
new/img-proof-5.2.0/img_proof/ipa_oci.py
--- old/img-proof-5.1.0/img_proof/ipa_oci.py 2020-06-01 22:49:26.000000000
+0200
+++ new/img-proof-5.2.0/img_proof/ipa_oci.py 2020-06-07 21:09:18.000000000
+0200
@@ -2,7 +2,7 @@
"""Cloud module for testing Oracle OCI images."""
-# Copyright (c) 2019 SUSE LLC. All rights reserved.
+# Copyright (c) 2020 SUSE LLC. All rights reserved.
#
# This file is part of ipa. Ipa provides an api and command line
# utilities for testing images in the Public Cloud.
@@ -65,7 +65,8 @@
tenancy=None,
oci_user_id=None,
enable_secure_boot=None,
- enable_uefi=None
+ enable_uefi=None,
+ log_callback=None
):
"""Initialize OCI cloud framework class."""
super(OCICloud, self).__init__(
@@ -93,7 +94,8 @@
ssh_user,
subnet_id,
enable_secure_boot,
- enable_uefi
+ enable_uefi,
+ log_callback
)
self.availability_domain = (
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/ipa_redhat.py
new/img-proof-5.2.0/img_proof/ipa_redhat.py
--- old/img-proof-5.1.0/img_proof/ipa_redhat.py 1970-01-01 01:00:00.000000000
+0100
+++ new/img-proof-5.2.0/img_proof/ipa_redhat.py 2020-06-07 21:09:18.000000000
+0200
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+
+"""Red Hat distro family module and sync points."""
+
+# Copyright (c) 2020 Neal Gompa. All rights reserved.
+#
+# This file is part of img_proof. img_proof provides an api and command line
+# utilities for testing images in the Public Cloud.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from img_proof.ipa_distro import Distro
+from img_proof.ipa_exceptions import IpaRedHatException
+
+
+class RedHat(Distro):
+ """Red Hat distro class."""
+
+ def get_install_cmd(self):
+ """Return install package command for Red Hat distributions."""
+ return 'dnf --assumeyes --nogpgcheck install'
+
+ def get_refresh_repo_cmd(self):
+ """Return refresh repo command for Red Hat distributions."""
+ return 'dnf --assumeyes makecache'
+
+ def get_stop_ssh_service_cmd(self):
+ """
+ Return command to stop SSH service for Red Hat distributions.
+
+ SSH stop command determined by init system.
+ """
+ if self.init_system == 'systemd':
+ return 'systemctl stop sshd.service'
+ elif self.init_system == 'init':
+ return 'service sshd stop'
+ else:
+ raise IpaRedHatException(
+ 'The init system for this Red Hat system cannot be determined.'
+ )
+
+ def get_update_cmd(self):
+ """Return command to update Red Hat distribution instance."""
+ return 'dnf --assumeyes upgrade'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/ipa_rhel.py
new/img-proof-5.2.0/img_proof/ipa_rhel.py
--- old/img-proof-5.1.0/img_proof/ipa_rhel.py 1970-01-01 01:00:00.000000000
+0100
+++ new/img-proof-5.2.0/img_proof/ipa_rhel.py 2020-06-07 21:09:18.000000000
+0200
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+"""RHEL distro module and sync points."""
+
+# Copyright (c) 2020 Neal Gompa. All rights reserved.
+#
+# This file is part of img_proof. img_proof provides an api and command line
+# utilities for testing images in the Public Cloud.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from img_proof.ipa_redhat import RedHat
+
+
+class RHEL(RedHat):
+ """RHEL distro class."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/ipa_utils.py
new/img-proof-5.2.0/img_proof/ipa_utils.py
--- old/img-proof-5.1.0/img_proof/ipa_utils.py 2020-06-01 22:49:26.000000000
+0200
+++ new/img-proof-5.2.0/img_proof/ipa_utils.py 2020-06-07 21:09:18.000000000
+0200
@@ -2,7 +2,7 @@
"""Utility functions."""
-# Copyright (c) 2019 SUSE LLC. All rights reserved.
+# Copyright (c) 2020 SUSE LLC. All rights reserved.
#
# This file is part of img_proof. img_proof provides an api and command line
# utilities for testing images in the Public Cloud.
@@ -22,6 +22,7 @@
import configparser
import fnmatch
+import logging
import os
import random
import sys
@@ -549,3 +550,18 @@
description or ''
)
f.write(out.strip() + '\n')
+
+
+def get_logger(log_level):
+ """
+ Return new console logger at provided log level.
+ """
+ logger = logging.getLogger('img_proof')
+ logger.setLevel(log_level)
+
+ console_handler = logging.StreamHandler()
+ console_handler.setLevel(log_level)
+ console_handler.setFormatter(logging.Formatter('%(message)s'))
+
+ logger.addHandler(console_handler)
+ return logger
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof/scripts/cli.py
new/img-proof-5.2.0/img_proof/scripts/cli.py
--- old/img-proof-5.1.0/img_proof/scripts/cli.py 2020-06-01
22:49:26.000000000 +0200
+++ new/img-proof-5.2.0/img_proof/scripts/cli.py 2020-06-07
21:09:18.000000000 +0200
@@ -2,7 +2,7 @@
"""img-proof CLI endpoints using click library."""
-# Copyright (c) 2019 SUSE LLC. All rights reserved.
+# Copyright (c) 2020 SUSE LLC. All rights reserved.
#
# This file is part of img-proof. img-proof provides an api and command line
# utilities for testing images in the Public Cloud.
@@ -338,6 +338,8 @@
tests):
"""Test image in the given framework using the supplied test files."""
no_color = context.obj['no_color']
+ logger = ipa_utils.get_logger(log_level)
+
try:
status, results = test_image(
cloud,
@@ -381,7 +383,8 @@
tenancy,
oci_user_id,
enable_secure_boot,
- enable_uefi
+ enable_uefi,
+ logger
)
echo_results(results, no_color)
sys.exit(status)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof.egg-info/PKG-INFO
new/img-proof-5.2.0/img_proof.egg-info/PKG-INFO
--- old/img-proof-5.1.0/img_proof.egg-info/PKG-INFO 2020-06-01
22:50:18.000000000 +0200
+++ new/img-proof-5.2.0/img_proof.egg-info/PKG-INFO 2020-06-07
21:10:09.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: img-proof
-Version: 5.1.0
+Version: 5.2.0
Summary: Package for automated testing of cloud images.
Home-page: https://github.com/SUSE-Enceladus/img-proof
Author: SUSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/img_proof.egg-info/SOURCES.txt
new/img-proof-5.2.0/img_proof.egg-info/SOURCES.txt
--- old/img-proof-5.1.0/img_proof.egg-info/SOURCES.txt 2020-06-01
22:50:18.000000000 +0200
+++ new/img-proof-5.2.0/img_proof.egg-info/SOURCES.txt 2020-06-07
21:10:09.000000000 +0200
@@ -19,9 +19,12 @@
img_proof/ipa_distro.py
img_proof/ipa_ec2.py
img_proof/ipa_exceptions.py
+img_proof/ipa_fedora.py
img_proof/ipa_gce.py
img_proof/ipa_oci.py
img_proof/ipa_opensuse_leap.py
+img_proof/ipa_redhat.py
+img_proof/ipa_rhel.py
img_proof/ipa_sles.py
img_proof/ipa_ssh.py
img_proof/ipa_utils.py
@@ -45,9 +48,12 @@
tests/test_ipa_controller.py
tests/test_ipa_distro.py
tests/test_ipa_ec2.py
+tests/test_ipa_fedora_distro.py
tests/test_ipa_gce.py
tests/test_ipa_oci.py
tests/test_ipa_opensuse_leap_distro.py
+tests/test_ipa_redhat_distro.py
+tests/test_ipa_rhel_distro.py
tests/test_ipa_sles_distro.py
tests/test_ipa_ssh.py
tests/test_ipa_utils.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/package/python3-img-proof.spec
new/img-proof-5.2.0/package/python3-img-proof.spec
--- old/img-proof-5.1.0/package/python3-img-proof.spec 2020-06-01
22:49:26.000000000 +0200
+++ new/img-proof-5.2.0/package/python3-img-proof.spec 2020-06-07
21:09:18.000000000 +0200
@@ -18,7 +18,7 @@
%bcond_without test
Name: python3-img-proof
-Version: 5.1.0
+Version: 5.2.0
Release: 0
Summary: Command line and API for testing custom images
License: GPL-3.0-or-later
@@ -59,7 +59,7 @@
Requires: python3-pytest
Requires: python3-testinfra
BuildArch: noarch
-Obsoletes: python3-ipa < 5.1.0
+Obsoletes: python3-ipa < 5.2.0
%description
img-proof provides a command line utility to test images in
@@ -70,7 +70,7 @@
Group: Development/Languages/Python
Requires: python3-susepubliccloudinfo
PreReq: python3-img-proof = %{version}
-Obsoletes: python3-ipa-tests < 5.1.0
+Obsoletes: python3-ipa-tests < 5.2.0
%description tests
Directory of infrastructure tests for testing images.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/setup.cfg
new/img-proof-5.2.0/setup.cfg
--- old/img-proof-5.1.0/setup.cfg 2020-06-01 22:50:19.000000000 +0200
+++ new/img-proof-5.2.0/setup.cfg 2020-06-07 21:10:09.000000000 +0200
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 5.1.0
+current_version = 5.2.0
commit = True
tag = False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/setup.py new/img-proof-5.2.0/setup.py
--- old/img-proof-5.1.0/setup.py 2020-06-01 22:49:26.000000000 +0200
+++ new/img-proof-5.2.0/setup.py 2020-06-07 21:09:18.000000000 +0200
@@ -43,7 +43,7 @@
setup(
name='img-proof',
- version='5.1.0',
+ version='5.2.0',
description="Package for automated testing of cloud images.",
long_description=readme,
long_description_content_type="text/markdown",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/tests/test_ipa_fedora_distro.py
new/img-proof-5.2.0/tests/test_ipa_fedora_distro.py
--- old/img-proof-5.1.0/tests/test_ipa_fedora_distro.py 1970-01-01
01:00:00.000000000 +0100
+++ new/img-proof-5.2.0/tests/test_ipa_fedora_distro.py 2020-06-07
21:09:18.000000000 +0200
@@ -0,0 +1,39 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+
+"""img_proof Fedora distro unit tests."""
+
+# Copyright (c) 2020 Neal Gompa. All rights reserved.
+#
+# This file is part of img_proof. img_proof provides an api and command line
+# utilities for testing images in the Public Cloud.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from img_proof.ipa_fedora import Fedora
+
+from unittest.mock import MagicMock, patch
+
+
+def test_fedora_set_init_system():
+ """Test Fedora set init system method."""
+ client = MagicMock()
+ fedora = Fedora()
+
+ with patch('img_proof.ipa_utils.execute_ssh_command',
+ MagicMock(return_value='systemd')) as mocked:
+ fedora._set_init_system(client)
+
+ assert fedora.init_system == 'systemd'
+ mocked.assert_called_once_with(client, 'ps -p 1 -o comm=')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/tests/test_ipa_redhat_distro.py
new/img-proof-5.2.0/tests/test_ipa_redhat_distro.py
--- old/img-proof-5.1.0/tests/test_ipa_redhat_distro.py 1970-01-01
01:00:00.000000000 +0100
+++ new/img-proof-5.2.0/tests/test_ipa_redhat_distro.py 2020-06-07
21:09:18.000000000 +0200
@@ -0,0 +1,161 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+
+"""img_proof Red Hat distro unit tests."""
+
+# Copyright (c) 2020 Neal Gompa. All rights reserved.
+#
+# This file is part of img_proof. img_proof provides an api and command line
+# utilities for testing images in the Public Cloud.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import pytest
+
+from img_proof.ipa_exceptions import IpaDistroException, IpaRedHatException
+from img_proof.ipa_redhat import RedHat
+
+from unittest.mock import MagicMock, patch
+
+
+def test_redhat_get_stop_ssh_cmd():
+ """Test Red Hat get stop ssh cmd method."""
+ redhat = RedHat()
+
+ redhat.init_system = 'systemd'
+ assert redhat.get_stop_ssh_service_cmd() == 'systemctl stop sshd.service'
+
+ redhat.init_system = 'init'
+ assert redhat.get_stop_ssh_service_cmd() == 'service sshd stop'
+
+ redhat.init_system = 'fake'
+ with pytest.raises(IpaRedHatException) as error:
+ redhat.get_stop_ssh_service_cmd()
+ assert str(error.value) == \
+ 'The init system for this Red Hat system cannot be determined.'
+
+
+def test_redhat_install_package():
+ """Test install package method for Red Hat distro."""
+ client = MagicMock()
+ redhat = RedHat()
+
+ with patch('img_proof.ipa_utils.execute_ssh_command',
+ MagicMock(return_value='')) as mocked:
+ redhat.install_package(client, 'python')
+
+ mocked.assert_called_once_with(
+ client,
+ "sudo sh -c 'dnf --assumeyes --nogpgcheck install python'"
+ )
+
+
+@patch('img_proof.ipa_distro.time')
+def test_redhat_reboot(mock_time):
+ """Test soft reboot method for Red Hat distro."""
+ client = MagicMock()
+ channel = MagicMock()
+ transport = MagicMock()
+ transport.open_session.return_value = channel
+ client.get_transport.return_value = transport
+ redhat = RedHat()
+ redhat.init_system = 'systemd'
+
+ redhat.reboot(client)
+
+ channel.exec_command.assert_called_once_with(
+ "sudo sh -c '(sleep 1 && systemctl stop sshd.service "
+ "&& shutdown -r now &)' && exit"
+ )
+
+
+def test_redhat_reboot_exception():
+ """Test soft reboot method exception for Red Hat distro."""
+ client = MagicMock()
+ client.get_transport.side_effect = Exception('ERROR!')
+ redhat = RedHat()
+ redhat.init_system = 'systemd'
+
+ with pytest.raises(IpaDistroException):
+ redhat.reboot(client)
+
+
+def test_redhat_update():
+ """Test update method for Red Hat distro."""
+ client = MagicMock()
+ redhat = RedHat()
+
+ with patch('img_proof.ipa_utils.execute_ssh_command',
+ MagicMock(return_value='Update finished!')) as mocked:
+ output = redhat.update(client)
+
+ mocked.assert_called_once_with(
+ client,
+ "sudo sh -c 'dnf --assumeyes makecache;dnf --assumeyes upgrade'"
+ )
+ assert output == 'Update finished!'
+
+
+def test_redhat_update_exception():
+ """Test update method exception for Red Hat distro."""
+ client = MagicMock()
+ redhat = RedHat()
+
+ with patch('img_proof.ipa_utils.execute_ssh_command', MagicMock(
+ side_effect=Exception('ERROR!'))) as mocked:
+ pytest.raises(
+ IpaDistroException,
+ redhat.update,
+ client
+ )
+
+ mocked.assert_called_once_with(
+ client,
+ "sudo sh -c 'dnf --assumeyes makecache;dnf --assumeyes upgrade'"
+ )
+
+
+def test_redhat_refresh():
+ """Test refresh method for Red Hat distro."""
+ client = MagicMock()
+ redhat = RedHat()
+
+ with patch('img_proof.ipa_utils.execute_ssh_command',
+ MagicMock(return_value='Refresh finished!')) as mocked:
+ output = redhat.repo_refresh(client)
+
+ mocked.assert_called_once_with(
+ client,
+ "sudo sh -c 'dnf --assumeyes makecache'"
+ )
+ assert output == 'Refresh finished!'
+
+
+def test_redhat_refresh_exception():
+ """Test refresh method exception for Red Hat distro."""
+ client = MagicMock()
+ redhat = RedHat()
+
+ with patch('img_proof.ipa_utils.execute_ssh_command', MagicMock(
+ side_effect=Exception('ERROR!'))) as mocked:
+ pytest.raises(
+ IpaDistroException,
+ redhat.repo_refresh,
+ client
+ )
+
+ mocked.assert_called_once_with(
+ client,
+ "sudo sh -c 'dnf --assumeyes makecache'"
+ )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/img-proof-5.1.0/tests/test_ipa_rhel_distro.py
new/img-proof-5.2.0/tests/test_ipa_rhel_distro.py
--- old/img-proof-5.1.0/tests/test_ipa_rhel_distro.py 1970-01-01
01:00:00.000000000 +0100
+++ new/img-proof-5.2.0/tests/test_ipa_rhel_distro.py 2020-06-07
21:09:18.000000000 +0200
@@ -0,0 +1,39 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+
+"""img_proof RHEL distro unit tests."""
+
+# Copyright (c) 2020 Neal Gompa. All rights reserved.
+#
+# This file is part of img_proof. img_proof provides an api and command line
+# utilities for testing images in the Public Cloud.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from img_proof.ipa_rhel import RHEL
+
+from unittest.mock import MagicMock, patch
+
+
+def test_rhel_set_init_system():
+ """Test RHEL set init system method."""
+ client = MagicMock()
+ rhel = RHEL()
+
+ with patch('img_proof.ipa_utils.execute_ssh_command',
+ MagicMock(return_value='systemd')) as mocked:
+ rhel._set_init_system(client)
+
+ assert rhel.init_system == 'systemd'
+ mocked.assert_called_once_with(client, 'ps -p 1 -o comm=')