[libvirt] [tck PATCH v2 00/15] Misc fixes to the TCK

Some final misc fixes before doing a new release Daniel P. Berrangé (15): rpm: use standard perl variables rpm: add some missing dependencies rpm: remove obsolete clean section rpm: remove obsolete build root setting rpm: remove obsolete group setting rpm: cleanup docs file list rpm: delete redundant changelog build: misc updates the Module::Build config conf: update URLs for Fedora 28 images build: ignore more auto generated files scripts: disable known hosts file lib: use Test::More directly instead of Test::Builder lib: merge NetworkHelpers module into main TCK module license: only refer to the GPL not Artistic lib: fix array value accessor to use preferred style .gitignore | 3 + Build.PL | 12 +- LICENSE | 159 ---------------------- MANIFEST | 2 - conf/default.cfg | 12 +- lib/Sys/Virt/TCK.pm | 91 +++++++++++-- lib/Sys/Virt/TCK/NetworkHelpers.pm | 72 ---------- perl-Sys-Virt-TCK.spec.PL | 41 +++--- scripts/domain/180-interface-parameters.t | 1 - scripts/nwfilter/100-ping-still-working.t | 1 - scripts/nwfilter/210-no-mac-spoofing.t | 4 +- scripts/nwfilter/220-no-ip-spoofing.t | 4 +- scripts/nwfilter/230-no-mac-broadcast.t | 4 +- scripts/nwfilter/240-no-arp-spoofing.t | 4 +- scripts/nwfilter/300-vsitype.t | 1 - 15 files changed, 119 insertions(+), 292 deletions(-) delete mode 100644 lib/Sys/Virt/TCK/NetworkHelpers.pm -- 2.17.0

We don't need to manually build variables for perl install locations as RPM includes that. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- perl-Sys-Virt-TCK.spec.PL | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/perl-Sys-Virt-TCK.spec.PL b/perl-Sys-Virt-TCK.spec.PL index aac6cf6..4b1683f 100644 --- a/perl-Sys-Virt-TCK.spec.PL +++ b/perl-Sys-Virt-TCK.spec.PL @@ -24,13 +24,6 @@ close SPEC; __DATA__ # Automatically generated by perl-Sys-Virt-TCK.spec.PL -%define perlvendorarch %(perl -e 'use Config; print $Config{installvendorarch}') -%define perlvendorlib %(perl -e 'use Config; print $Config{installvendorlib}') -%define perlvendorprefix %(perl -e 'use Config; print $Config{vendorprefix}') -%define perlvendorman1 %{perlvendorprefix}/share/man/man1 -%define perlvendorman3 %{perlvendorprefix}/share/man/man3 -%define perlversion %(perl -e 'use Config; print $Config{version}') - %define appname Sys-Virt-TCK Summary: Sys::Virt::TCK - libvirt Technology Compatibility Kit @@ -42,7 +35,7 @@ Group: Development/Tools Source: http://libvirt.org/sources/tck/%{appname}-v%{version}.tar.gz Url: http://libvirt.org/ BuildRoot: %{_tmppath}/%{appname}-%{version}-%{release}-root-%(%{__id_u} -n) -Requires: perl >= %{perlversion} +Requires: perl >= %{perl_version} Requires: libvirt >= 0.6.2 BuildRequires: perl(accessors) BuildRequires: perl(App::Prove) @@ -118,10 +111,9 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/libvirt-tck %dir %{_datadir}/libvirt-tck %{_datadir}/libvirt-tck/* -%{perlvendorman1}/* -#%{perlvendorman3}/* -%{perlvendorlib}/Sys/Virt/TCK.pm -%{perlvendorlib}/Sys/Virt/TCK/ +%{_mandir}/man1/* +%{perl_vendorlib}/Sys/Virt/TCK.pm +%{perl_vendorlib}/Sys/Virt/TCK/ %dir %{_localstatedir}/cache/libvirt-tck %changelog -- 2.17.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- perl-Sys-Virt-TCK.spec.PL | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/perl-Sys-Virt-TCK.spec.PL b/perl-Sys-Virt-TCK.spec.PL index 4b1683f..69e5621 100644 --- a/perl-Sys-Virt-TCK.spec.PL +++ b/perl-Sys-Virt-TCK.spec.PL @@ -35,8 +35,12 @@ Group: Development/Tools Source: http://libvirt.org/sources/tck/%{appname}-v%{version}.tar.gz Url: http://libvirt.org/ BuildRoot: %{_tmppath}/%{appname}-%{version}-%{release}-root-%(%{__id_u} -n) -Requires: perl >= %{perl_version} -Requires: libvirt >= 0.6.2 +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +Requires: libvirt >= 4.4.0 +%if 0%{?fedora} || 0%{?rhel} > 7 +BuildRequires: perl-interpreter +BuildRequires: perl-generators +%endif BuildRequires: perl(accessors) BuildRequires: perl(App::Prove) BuildRequires: perl(Config::Record) @@ -57,9 +61,12 @@ BuildRequires: perl(TAP::Harness::Archive) BuildRequires: perl(Test::Builder) BuildRequires: perl(Test::More) BuildRequires: perl(Sub::Uplevel) -BuildRequires: perl(Sys::Virt) >= 0.2.0 +BuildRequires: perl(Sys::Virt) >= 0.2.1 BuildRequires: perl(XML::Twig) BuildRequires: perl(XML::Writer) +BuildRequires: perl(XML::XPath) +BuildRequires: perl(Test::Pod) +BuildRequires: perl(Test::Pod::Coverage) # RPM autoprovides misses these 3 Requires: perl(Test::Exception) Requires: perl(TAP::Formatter::HTML) @@ -69,6 +76,8 @@ Requires: perl(Net::OpenSSH) Requires: perl(IO::Pty) Requires: libguestfs-tools Requires: /usr/bin/mkisofs +# Want to force this minimal version, so don't rely on RPM autoprov +Requires: perl(Sys::Virt) >= 0.2.1 BuildArchitectures: noarch %description -- 2.17.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- perl-Sys-Virt-TCK.spec.PL | 4 ---- 1 file changed, 4 deletions(-) diff --git a/perl-Sys-Virt-TCK.spec.PL b/perl-Sys-Virt-TCK.spec.PL index 69e5621..be40d40 100644 --- a/perl-Sys-Virt-TCK.spec.PL +++ b/perl-Sys-Virt-TCK.spec.PL @@ -105,10 +105,6 @@ find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \; %__install -m 0755 -d $RPM_BUILD_ROOT%{_localstatedir}/cache/libvirt-tck -%clean -rm -rf $RPM_BUILD_ROOT - - %files %defattr(-,root,root) #%doc AUTHORS -- 2.17.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- perl-Sys-Virt-TCK.spec.PL | 1 - 1 file changed, 1 deletion(-) diff --git a/perl-Sys-Virt-TCK.spec.PL b/perl-Sys-Virt-TCK.spec.PL index be40d40..ab2194f 100644 --- a/perl-Sys-Virt-TCK.spec.PL +++ b/perl-Sys-Virt-TCK.spec.PL @@ -34,7 +34,6 @@ License: GPLv2 Group: Development/Tools Source: http://libvirt.org/sources/tck/%{appname}-v%{version}.tar.gz Url: http://libvirt.org/ -BuildRoot: %{_tmppath}/%{appname}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires: libvirt >= 4.4.0 %if 0%{?fedora} || 0%{?rhel} > 7 -- 2.17.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- perl-Sys-Virt-TCK.spec.PL | 1 - 1 file changed, 1 deletion(-) diff --git a/perl-Sys-Virt-TCK.spec.PL b/perl-Sys-Virt-TCK.spec.PL index ab2194f..0dea8de 100644 --- a/perl-Sys-Virt-TCK.spec.PL +++ b/perl-Sys-Virt-TCK.spec.PL @@ -31,7 +31,6 @@ Name: perl-%{appname} Version: @VERSION@ Release: 1 License: GPLv2 -Group: Development/Tools Source: http://libvirt.org/sources/tck/%{appname}-v%{version}.tar.gz Url: http://libvirt.org/ Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) -- 2.17.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- perl-Sys-Virt-TCK.spec.PL | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/perl-Sys-Virt-TCK.spec.PL b/perl-Sys-Virt-TCK.spec.PL index 0dea8de..a9b4148 100644 --- a/perl-Sys-Virt-TCK.spec.PL +++ b/perl-Sys-Virt-TCK.spec.PL @@ -105,10 +105,8 @@ find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \; %files %defattr(-,root,root) -#%doc AUTHORS -%doc LICENSE +%license LICENSE %doc README -#%doc INSTALL %dir %{_sysconfdir}/libvirt-tck %config(noreplace) %{_sysconfdir}/libvirt-tck/default.cfg %{_bindir}/libvirt-tck -- 2.17.0

The changelog entries only make sense in the context of a distro, not upstream. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- perl-Sys-Virt-TCK.spec.PL | 2 -- 1 file changed, 2 deletions(-) diff --git a/perl-Sys-Virt-TCK.spec.PL b/perl-Sys-Virt-TCK.spec.PL index a9b4148..0026b7e 100644 --- a/perl-Sys-Virt-TCK.spec.PL +++ b/perl-Sys-Virt-TCK.spec.PL @@ -118,5 +118,3 @@ find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \; %dir %{_localstatedir}/cache/libvirt-tck %changelog -* Fri Mar 24 2006 <berrange@redhat.com> - 0.0.1-1 -- Initial build -- 2.17.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- Build.PL | 12 +++++++----- MANIFEST | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Build.PL b/Build.PL index bf2d7a9..75a1436 100644 --- a/Build.PL +++ b/Build.PL @@ -61,6 +61,9 @@ EOF my $b = $class->new( module_name => "Sys::Virt::TCK", license => 'gpl', + configure_requires => { + 'Module::Build' => 0, + }, dist_author => 'Daniel Berrange <dan@berrange.com>', dist_abstract => 'libvirt Technology Compatability Kit', requires => { @@ -100,13 +103,12 @@ my $b = $class->new( script_files => [ "bin/libvirt-tck", ], - create_makefile_pl => 'passthrough', meta_add => { resources => { - license => "http://www.gnu.org/licenses/gpl.html", - homepage => "http://libvirt.org/", - repository => "http://libvirt.org/hg/libvirt-tck", - MailingList => "http://www.redhat.com/mailman/listinfo/libvir-list", + license => "https://www.gnu.org/licenses/gpl.html", + homepage => "https://libvirt.org/", + repository => "https://libvirt.org/git/?p=libvirt-tck.git;a=summary", + MailingList => "https://www.redhat.com/mailman/listinfo/libvir-list", }, }, conf_files => { diff --git a/MANIFEST b/MANIFEST index b632328..9338981 100644 --- a/MANIFEST +++ b/MANIFEST @@ -15,7 +15,6 @@ lib/Sys/Virt/TCK/StorageVolBuilder.pm lib/Sys/Virt/TCK/TAP/XMLFormatter.pm lib/Sys/Virt/TCK/TAP/XMLFormatterSession.pm LICENSE -Makefile.PL MANIFEST META.json META.yml -- 2.17.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- conf/default.cfg | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/default.cfg b/conf/default.cfg index d9d858c..494c303 100644 --- a/conf/default.cfg +++ b/conf/default.cfg @@ -49,7 +49,7 @@ images = ( hvm xen ) - osname = fedora-27 + osname = fedora-28 } ) @@ -75,15 +75,15 @@ images = ( # empty sparse root FS will be created # kernels = ( - # Fedora 15 i686 PAE has pv_ops, so one kernel can do both Xen and KVM guests here + # Fedora 28 i686 PAE has pv_ops, so one kernel can do both Xen and KVM guests here { arch = i686 ostype = ( hvm xen ) - kernel = http://dl.fedoraproject.org/pub/fedora/linux/releases/27/Everything/i386/os/... - initrd = http://dl.fedoraproject.org/pub/fedora/linux/releases/27/Everything/i386/os/... + kernel = http://dl.fedoraproject.org/pub/fedora-secondary/releases/28/Everything/i386... + initrd = http://dl.fedoraproject.org/pub/fedora-secondary/releases/28/Everything/i386... } # Fedora 15 x86_64 has pv_ops, so one kernel can do both Xen and KVM guests here { @@ -92,8 +92,8 @@ kernels = ( hvm xen ) - kernel = http://dl.fedoraproject.org/pub/fedora/linux/releases/27/Everything/x86_64/o... - initrd = http://dl.fedoraproject.org/pub/fedora/linux/releases/27/Everything/x86_64/o... + kernel = http://dl.fedoraproject.org/pub/fedora/linux/releases/28/Everything/x86_64/o... + initrd = http://dl.fedoraproject.org/pub/fedora/linux/releases/28/Everything/x86_64/o... } # User mode linux i686 needs custom kernel + root filesystem { -- 2.17.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index ca3e424..65b446f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,10 @@ *.orig *~ Build +META.json META.yml +MYMETA.json +MYMETA.yml Makefile Makefile.PL Makefile.old -- 2.17.0

Despite having StrictHostKeyChecking=no, SSH still complains about the host key mismatch and disables password auth as a result. Using /dev/null as the known_hosts file ensures the keys are never saved to the user's profile. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- scripts/nwfilter/210-no-mac-spoofing.t | 3 ++- scripts/nwfilter/220-no-ip-spoofing.t | 3 ++- scripts/nwfilter/230-no-mac-broadcast.t | 3 ++- scripts/nwfilter/240-no-arp-spoofing.t | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-no-mac-spoofing.t index 99c5058..95b1499 100644 --- a/scripts/nwfilter/210-no-mac-spoofing.t +++ b/scripts/nwfilter/210-no-mac-spoofing.t @@ -97,7 +97,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=off"]); # now bring eth0 down, change MAC and bring it up again diag "fiddling with mac"; diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-no-ip-spoofing.t index 85c4807..a1da6eb 100644 --- a/scripts/nwfilter/220-no-ip-spoofing.t +++ b/scripts/nwfilter/220-no-ip-spoofing.t @@ -91,7 +91,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=no"]); # now bring eth0 down, change IP and bring it up again diag "preparing ip spoof"; diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230-no-mac-broadcast.t index b65b3fc..4254e7c 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -119,7 +119,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=no"]); # now generate a mac broadcast paket diag "generate mac broadcast"; diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t index 69851b6..882a385 100644 --- a/scripts/nwfilter/240-no-arp-spoofing.t +++ b/scripts/nwfilter/240-no-arp-spoofing.t @@ -100,7 +100,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=no"]); # now generate a arp spoofing packets diag "generate arpspoof script"; -- 2.17.0

On 06/08/2018 10:55 AM, Daniel P. Berrangé wrote:
Despite having StrictHostKeyChecking=no, SSH still complains about the host key mismatch and disables password auth as a result. Using /dev/null as the known_hosts file ensures the keys are never saved to the user's profile.
Interesting. I had thought that I had run on a machine that didn't have anything in its known_hosts file. Maybe I've done something to my cached test image that causes it to succeed?
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org> (really what we should be doing for these tests is to connect to the guest's serial console, especially for no-ip-spoofing and no-mac-spoofing, since they actually make the guest unreachable for a short time. But what we have now works, so there's lots more important things to worry about...)
--- scripts/nwfilter/210-no-mac-spoofing.t | 3 ++- scripts/nwfilter/220-no-ip-spoofing.t | 3 ++- scripts/nwfilter/230-no-mac-broadcast.t | 3 ++- scripts/nwfilter/240-no-arp-spoofing.t | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-no-mac-spoofing.t index 99c5058..95b1499 100644 --- a/scripts/nwfilter/210-no-mac-spoofing.t +++ b/scripts/nwfilter/210-no-mac-spoofing.t @@ -97,7 +97,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=off"]);
# now bring eth0 down, change MAC and bring it up again diag "fiddling with mac"; diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-no-ip-spoofing.t index 85c4807..a1da6eb 100644 --- a/scripts/nwfilter/220-no-ip-spoofing.t +++ b/scripts/nwfilter/220-no-ip-spoofing.t @@ -91,7 +91,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=no"]);
# now bring eth0 down, change IP and bring it up again diag "preparing ip spoof"; diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230-no-mac-broadcast.t index b65b3fc..4254e7c 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -119,7 +119,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=no"]);
# now generate a mac broadcast paket diag "generate mac broadcast"; diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t index 69851b6..882a385 100644 --- a/scripts/nwfilter/240-no-arp-spoofing.t +++ b/scripts/nwfilter/240-no-arp-spoofing.t @@ -100,7 +100,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=no"]);
# now generate a arp spoofing packets diag "generate arpspoof script";

On Fri, Jun 08, 2018 at 11:29:35AM -0400, Laine Stump wrote:
On 06/08/2018 10:55 AM, Daniel P. Berrangé wrote:
Despite having StrictHostKeyChecking=no, SSH still complains about the host key mismatch and disables password auth as a result. Using /dev/null as the known_hosts file ensures the keys are never saved to the user's profile.
Interesting. I had thought that I had run on a machine that didn't have anything in its known_hosts file. Maybe I've done something to my cached test image that causes it to succeed?
I'm really confused because what's there ought to work according to my reading of it, but it seems even with the StrictHostKeyChecking=no, if you specifically have password auth, ssh will complain to avoid MITM stealing the password. So the known_hosts /dev/null big hammer just stops that.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
(really what we should be doing for these tests is to connect to the guest's serial console, especially for no-ip-spoofing and no-mac-spoofing, since they actually make the guest unreachable for a short time. But what we have now works, so there's lots more important things to worry about...)
--- scripts/nwfilter/210-no-mac-spoofing.t | 3 ++- scripts/nwfilter/220-no-ip-spoofing.t | 3 ++- scripts/nwfilter/230-no-mac-broadcast.t | 3 ++- scripts/nwfilter/240-no-arp-spoofing.t | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-no-mac-spoofing.t index 99c5058..95b1499 100644 --- a/scripts/nwfilter/210-no-mac-spoofing.t +++ b/scripts/nwfilter/210-no-mac-spoofing.t @@ -97,7 +97,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=off"]);
# now bring eth0 down, change MAC and bring it up again diag "fiddling with mac"; diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-no-ip-spoofing.t index 85c4807..a1da6eb 100644 --- a/scripts/nwfilter/220-no-ip-spoofing.t +++ b/scripts/nwfilter/220-no-ip-spoofing.t @@ -91,7 +91,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=no"]);
# now bring eth0 down, change IP and bring it up again diag "preparing ip spoof"; diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230-no-mac-broadcast.t index b65b3fc..4254e7c 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -119,7 +119,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=no"]);
# now generate a mac broadcast paket diag "generate mac broadcast"; diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t index 69851b6..882a385 100644 --- a/scripts/nwfilter/240-no-arp-spoofing.t +++ b/scripts/nwfilter/240-no-arp-spoofing.t @@ -100,7 +100,8 @@ diag "ssh'ing into $guestip"; my $ssh = Net::OpenSSH->new($guestip, user => "root", password => $tck->root_password(), - master_opts => [-o => "StrictHostKeyChecking=no"]); + master_opts => [-o => "UserKnownHostsFile=/dev/null", + -o => "StrictHostKeyChecking=no"]);
# now generate a arp spoofing packets diag "generate arpspoof script";
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- lib/Sys/Virt/TCK.pm | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index 29280f6..1a835bd 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -35,7 +35,7 @@ use XML::XPath; use Carp qw(cluck carp); use Fcntl qw(O_RDONLY SEEK_END); -use Test::Builder; +use Test::More; use Sub::Uplevel qw(uplevel); use base qw(Exporter); @@ -1035,8 +1035,6 @@ sub _try_as_caller { }; -my $Tester = Test::Builder->new; - sub ok_object($$$;$) { my $coderef = shift; my $class = shift; @@ -1052,16 +1050,16 @@ sub ok_object($$$;$) { $ret && ref($ret) && $ret->isa($class) && (!defined $name || ($ret->get_name() eq $name)); - $Tester->ok($ok, $description); + ok($ok, $description); unless ($ok) { - $Tester->diag("expected $class object" . ($name ? " with name $name" : "")); + diag("expected $class object" . ($name ? " with name $name" : "")); if ($exception) { - $Tester->diag("found '$exception'"); + diag("found '$exception'"); } else { if ($ret && ref($ret) && $ret->isa($class)) { - $Tester->diag("found $class object with name " . $ret->get_name); + diag("found $class object with name " . $ret->get_name); } else { - $Tester->diag("found '$ret'"); + diag("found '$ret'"); } } } @@ -1137,10 +1135,10 @@ sub ok_error(&$;$) { my $ok = ref($exception) && $exception->isa("Sys::Virt::Error") && (!defined $code || ($exception->code() == $code)); - $Tester->ok($ok, $description); + ok($ok, $description); unless ($ok) { - $Tester->diag("expecting Sys::Virt::Error object" . ($code ? " with code $code" : "")); - $Tester->diag("found '$exception'"); + diag("expecting Sys::Virt::Error object" . ($code ? " with code $code" : "")); + diag("found '$exception'"); } $@ = $exception; return $ok; -- 2.17.0

On 06/08/2018 10:55 AM, Daniel P. Berrangé wrote:
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
I don't pretend to know much of anything about this testing framework, but I guess this make the code here more like what's in the other files. Reviewed-by: Laine Stump <laine@laine.org>
--- lib/Sys/Virt/TCK.pm | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index 29280f6..1a835bd 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -35,7 +35,7 @@ use XML::XPath; use Carp qw(cluck carp); use Fcntl qw(O_RDONLY SEEK_END);
-use Test::Builder; +use Test::More; use Sub::Uplevel qw(uplevel); use base qw(Exporter);
@@ -1035,8 +1035,6 @@ sub _try_as_caller { };
-my $Tester = Test::Builder->new; - sub ok_object($$$;$) { my $coderef = shift; my $class = shift; @@ -1052,16 +1050,16 @@ sub ok_object($$$;$) { $ret && ref($ret) && $ret->isa($class) && (!defined $name || ($ret->get_name() eq $name));
- $Tester->ok($ok, $description); + ok($ok, $description); unless ($ok) { - $Tester->diag("expected $class object" . ($name ? " with name $name" : "")); + diag("expected $class object" . ($name ? " with name $name" : "")); if ($exception) { - $Tester->diag("found '$exception'"); + diag("found '$exception'"); } else { if ($ret && ref($ret) && $ret->isa($class)) { - $Tester->diag("found $class object with name " . $ret->get_name); + diag("found $class object with name " . $ret->get_name); } else { - $Tester->diag("found '$ret'"); + diag("found '$ret'"); } } } @@ -1137,10 +1135,10 @@ sub ok_error(&$;$) { my $ok = ref($exception) && $exception->isa("Sys::Virt::Error") && (!defined $code || ($exception->code() == $code));
- $Tester->ok($ok, $description); + ok($ok, $description); unless ($ok) { - $Tester->diag("expecting Sys::Virt::Error object" . ($code ? " with code $code" : "")); - $Tester->diag("found '$exception'"); + diag("expecting Sys::Virt::Error object" . ($code ? " with code $code" : "")); + diag("found '$exception'"); } $@ = $exception; return $ok;

The TCK module requires stuff in the NetworkHelpers and also vica-verca. This circular dependancy causes import problems, when trying to use the functions in NetworkHelpers from the TCK module. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- MANIFEST | 1 - lib/Sys/Virt/TCK.pm | 71 +++++++++++++++++++++- lib/Sys/Virt/TCK/NetworkHelpers.pm | 72 ----------------------- scripts/domain/180-interface-parameters.t | 1 - scripts/nwfilter/100-ping-still-working.t | 1 - scripts/nwfilter/210-no-mac-spoofing.t | 1 - scripts/nwfilter/220-no-ip-spoofing.t | 1 - scripts/nwfilter/230-no-mac-broadcast.t | 1 - scripts/nwfilter/240-no-arp-spoofing.t | 1 - scripts/nwfilter/300-vsitype.t | 1 - 10 files changed, 70 insertions(+), 81 deletions(-) delete mode 100644 lib/Sys/Virt/TCK/NetworkHelpers.pm diff --git a/MANIFEST b/MANIFEST index 9338981..79f93c0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -8,7 +8,6 @@ lib/Sys/Virt/TCK/Capabilities.pm lib/Sys/Virt/TCK/DomainBuilder.pm lib/Sys/Virt/TCK/Hooks.pm lib/Sys/Virt/TCK/NetworkBuilder.pm -lib/Sys/Virt/TCK/NetworkHelpers.pm lib/Sys/Virt/TCK/SELinux.pm lib/Sys/Virt/TCK/StoragePoolBuilder.pm lib/Sys/Virt/TCK/StorageVolBuilder.pm diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index 1a835bd..60bd136 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -34,6 +34,7 @@ use IO::Uncompress::Bunzip2 qw(bunzip2); use XML::XPath; use Carp qw(cluck carp); use Fcntl qw(O_RDONLY SEEK_END); +use NetAddr::IP qw(:lower); use Test::More; use Sub::Uplevel qw(uplevel); @@ -41,7 +42,9 @@ use base qw(Exporter); our @EXPORT = qw(ok_error ok_domain ok_domain_snapshot ok_pool ok_volume ok_network ok_interface ok_node_device - xpath err_not_implemented); + xpath err_not_implemented get_first_macaddress + get_first_interface_target_dev get_network_ip + get_ip_from_leases shutdown_vm_gracefully); our $VERSION = 'v0.1.0'; @@ -1230,4 +1233,70 @@ sub get_host_network_device { return $self->config("host_network_devices/[$devindex]", undef); } +sub get_first_macaddress { + my $dom = shift; + my $mac = xpath($dom, "string(/domain/devices/interface[1]/mac/\@address)"); + utf8::encode($mac); + return $mac; +} + +sub get_first_interface_target_dev { + my $dom = shift; + my $targetdev = xpath($dom, "string(/domain/devices/interface[1]/target/\@dev)"); + return $targetdev; +} + +sub get_network_ip { + my $conn = shift; + my $netname = shift; + diag "getting ip for network $netname"; + my $net = $conn->get_network_by_name($netname); + my $net_ip = xpath($net, "string(/network/ip[1]/\@address"); + my $net_mask = xpath($net, "string(/network/ip[1]/\@netmask"); + my $net_prefix = xpath($net, "string(/network/ip[1]/\@prefix"); + my $ip; + + if ($net_mask) { + $ip = NetAddr::IP->new($net_ip, $net_mask); + } elsif ($net_prefix) { + $ip = NetAddr::IP->new("$net_ip/$net_mask"); + } else { + $ip = NetAddr::IP->new("$net_ip"); + } + return $ip; +} + + +sub get_ip_from_leases{ + my $conn = shift; + my $netname = shift; + my $mac = shift; + + my $net = $conn->get_network_by_name($netname); + if ($net->can('get_dhcp_leases')) { + my @leases = $net->get_dhcp_leases($mac); + return @leases ? @leases[0]->{'ipaddr'} : undef; + } + + my $tmp = `grep $mac /var/lib/libvirt/dnsmasq/default.leases`; + my @fields = split(/ /, $tmp); + my $ip = $fields[2]; + return $ip; +} + + +sub shutdown_vm_gracefully { + my $dom = shift; + + my $target = time() + 30; + $dom->shutdown; + while ($dom->is_active()) { + sleep(1); + diag ".. waiting for virtual machine to shutdown.. "; + $dom->destroy() if time() > $target; + } + sleep(1); + diag ".. shutdown complete.. "; +} + 1; diff --git a/lib/Sys/Virt/TCK/NetworkHelpers.pm b/lib/Sys/Virt/TCK/NetworkHelpers.pm deleted file mode 100644 index 50ade0f..0000000 --- a/lib/Sys/Virt/TCK/NetworkHelpers.pm +++ /dev/null @@ -1,72 +0,0 @@ -use Sys::Virt::TCK qw(xpath); -use NetAddr::IP qw(:lower); -use strict; -use utf8; - -sub get_first_macaddress { - my $dom = shift; - my $mac = xpath($dom, "string(/domain/devices/interface[1]/mac/\@address)"); - utf8::encode($mac); - return $mac; -} - -sub get_first_interface_target_dev { - my $dom = shift; - my $targetdev = xpath($dom, "string(/domain/devices/interface[1]/target/\@dev)"); - return $targetdev; -} - -sub get_network_ip { - my $conn = shift; - my $netname = shift; - diag "getting ip for network $netname"; - my $net = $conn->get_network_by_name($netname); - my $net_ip = xpath($net, "string(/network/ip[1]/\@address"); - my $net_mask = xpath($net, "string(/network/ip[1]/\@netmask"); - my $net_prefix = xpath($net, "string(/network/ip[1]/\@prefix"); - my $ip; - - if ($net_mask) { - $ip = NetAddr::IP->new($net_ip, $net_mask); - } elsif ($net_prefix) { - $ip = NetAddr::IP->new("$net_ip/$net_mask"); - } else { - $ip = NetAddr::IP->new("$net_ip"); - } - return $ip; -} - - -sub get_ip_from_leases{ - my $conn = shift; - my $netname = shift; - my $mac = shift; - - my $net = $conn->get_network_by_name($netname); - if ($net->can('get_dhcp_leases')) { - my @leases = $net->get_dhcp_leases($mac); - return @leases ? @leases[0]->{'ipaddr'} : undef; - } - - my $tmp = `grep $mac /var/lib/libvirt/dnsmasq/default.leases`; - my @fields = split(/ /, $tmp); - my $ip = $fields[2]; - return $ip; -} - - -sub shutdown_vm_gracefully { - my $dom = shift; - - my $target = time() + 30; - $dom->shutdown; - while ($dom->is_active()) { - sleep(1); - diag ".. waiting for virtual machine to shutdown.. "; - $dom->destroy() if time() > $target; - } - sleep(1); - diag ".. shutdown complete.. "; -} - -1; diff --git a/scripts/domain/180-interface-parameters.t b/scripts/domain/180-interface-parameters.t index 66c7ed6..b3f0c19 100644 --- a/scripts/domain/180-interface-parameters.t +++ b/scripts/domain/180-interface-parameters.t @@ -33,7 +33,6 @@ use warnings; use Test::More tests => 10; use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use File::stat; diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/100-ping-still-working.t index 12f2c7c..a88eb02 100644 --- a/scripts/nwfilter/100-ping-still-working.t +++ b/scripts/nwfilter/100-ping-still-working.t @@ -30,7 +30,6 @@ use warnings; use Test::More tests => 4; use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use File::Spec::Functions qw(catfile catdir rootdir); diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-no-mac-spoofing.t index 95b1499..87c19e7 100644 --- a/scripts/nwfilter/210-no-mac-spoofing.t +++ b/scripts/nwfilter/210-no-mac-spoofing.t @@ -29,7 +29,6 @@ use warnings; use Test::More tests => 5; use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use Net::OpenSSH; diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-no-ip-spoofing.t index a1da6eb..bacb861 100644 --- a/scripts/nwfilter/220-no-ip-spoofing.t +++ b/scripts/nwfilter/220-no-ip-spoofing.t @@ -29,7 +29,6 @@ use warnings; use Test::More tests => 4; use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use Net::OpenSSH; diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230-no-mac-broadcast.t index 4254e7c..b518a81 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -29,7 +29,6 @@ use warnings; use Test::More tests => 4; use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use Net::OpenSSH; use File::Spec::Functions qw(catfile catdir rootdir); diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t index 882a385..77b36d2 100644 --- a/scripts/nwfilter/240-no-arp-spoofing.t +++ b/scripts/nwfilter/240-no-arp-spoofing.t @@ -29,7 +29,6 @@ use warnings; use Test::More tests => 4; use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use Net::OpenSSH; use File::Spec::Functions qw(catfile catdir rootdir); diff --git a/scripts/nwfilter/300-vsitype.t b/scripts/nwfilter/300-vsitype.t index 90d237f..3af9d4f 100644 --- a/scripts/nwfilter/300-vsitype.t +++ b/scripts/nwfilter/300-vsitype.t @@ -29,7 +29,6 @@ use warnings; use Test::More; use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use File::Spec::Functions qw(catfile catdir rootdir); -- 2.17.0

On 06/08/2018 10:55 AM, Daniel P. Berrangé wrote:
The TCK module requires stuff in the NetworkHelpers and also vica-verca. This circular dependancy causes import problems, when trying to use the functions in NetworkHelpers from the TCK module.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org> (but see below - there is a pre-existing bug in some code you're moving)
--- MANIFEST | 1 - lib/Sys/Virt/TCK.pm | 71 +++++++++++++++++++++- lib/Sys/Virt/TCK/NetworkHelpers.pm | 72 ----------------------- scripts/domain/180-interface-parameters.t | 1 - scripts/nwfilter/100-ping-still-working.t | 1 - scripts/nwfilter/210-no-mac-spoofing.t | 1 - scripts/nwfilter/220-no-ip-spoofing.t | 1 - scripts/nwfilter/230-no-mac-broadcast.t | 1 - scripts/nwfilter/240-no-arp-spoofing.t | 1 - scripts/nwfilter/300-vsitype.t | 1 - 10 files changed, 70 insertions(+), 81 deletions(-) delete mode 100644 lib/Sys/Virt/TCK/NetworkHelpers.pm
diff --git a/MANIFEST b/MANIFEST index 9338981..79f93c0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -8,7 +8,6 @@ lib/Sys/Virt/TCK/Capabilities.pm lib/Sys/Virt/TCK/DomainBuilder.pm lib/Sys/Virt/TCK/Hooks.pm lib/Sys/Virt/TCK/NetworkBuilder.pm -lib/Sys/Virt/TCK/NetworkHelpers.pm lib/Sys/Virt/TCK/SELinux.pm lib/Sys/Virt/TCK/StoragePoolBuilder.pm lib/Sys/Virt/TCK/StorageVolBuilder.pm diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index 1a835bd..60bd136 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -34,6 +34,7 @@ use IO::Uncompress::Bunzip2 qw(bunzip2); use XML::XPath; use Carp qw(cluck carp); use Fcntl qw(O_RDONLY SEEK_END); +use NetAddr::IP qw(:lower);
use Test::More; use Sub::Uplevel qw(uplevel); @@ -41,7 +42,9 @@ use base qw(Exporter);
our @EXPORT = qw(ok_error ok_domain ok_domain_snapshot ok_pool ok_volume ok_network ok_interface ok_node_device - xpath err_not_implemented); + xpath err_not_implemented get_first_macaddress + get_first_interface_target_dev get_network_ip + get_ip_from_leases shutdown_vm_gracefully);
our $VERSION = 'v0.1.0';
@@ -1230,4 +1233,70 @@ sub get_host_network_device { return $self->config("host_network_devices/[$devindex]", undef); }
+sub get_first_macaddress { + my $dom = shift; + my $mac = xpath($dom, "string(/domain/devices/interface[1]/mac/\@address)"); + utf8::encode($mac); + return $mac; +} + +sub get_first_interface_target_dev { + my $dom = shift; + my $targetdev = xpath($dom, "string(/domain/devices/interface[1]/target/\@dev)"); + return $targetdev; +} + +sub get_network_ip { + my $conn = shift; + my $netname = shift; + diag "getting ip for network $netname"; + my $net = $conn->get_network_by_name($netname); + my $net_ip = xpath($net, "string(/network/ip[1]/\@address"); + my $net_mask = xpath($net, "string(/network/ip[1]/\@netmask"); + my $net_prefix = xpath($net, "string(/network/ip[1]/\@prefix"); + my $ip; + + if ($net_mask) { + $ip = NetAddr::IP->new($net_ip, $net_mask); + } elsif ($net_prefix) { + $ip = NetAddr::IP->new("$net_ip/$net_mask");
Oops! I just noticed a bug in my function that you've moved - that final $net_mask should be $net_prefix. I assume you don't want to just squash that fix into here. Should I wait until you've pushed and send a patch, or ... ???
+ } else { + $ip = NetAddr::IP->new("$net_ip"); + } + return $ip; +} + + +sub get_ip_from_leases{ + my $conn = shift; + my $netname = shift; + my $mac = shift; + + my $net = $conn->get_network_by_name($netname); + if ($net->can('get_dhcp_leases')) { + my @leases = $net->get_dhcp_leases($mac); + return @leases ? @leases[0]->{'ipaddr'} : undef; + } + + my $tmp = `grep $mac /var/lib/libvirt/dnsmasq/default.leases`; + my @fields = split(/ /, $tmp); + my $ip = $fields[2]; + return $ip; +} + + +sub shutdown_vm_gracefully { + my $dom = shift; + + my $target = time() + 30; + $dom->shutdown; + while ($dom->is_active()) { + sleep(1); + diag ".. waiting for virtual machine to shutdown.. "; + $dom->destroy() if time() > $target; + } + sleep(1); + diag ".. shutdown complete.. "; +} + 1; diff --git a/lib/Sys/Virt/TCK/NetworkHelpers.pm b/lib/Sys/Virt/TCK/NetworkHelpers.pm deleted file mode 100644 index 50ade0f..0000000 --- a/lib/Sys/Virt/TCK/NetworkHelpers.pm +++ /dev/null @@ -1,72 +0,0 @@ -use Sys::Virt::TCK qw(xpath); -use NetAddr::IP qw(:lower); -use strict; -use utf8; - -sub get_first_macaddress { - my $dom = shift; - my $mac = xpath($dom, "string(/domain/devices/interface[1]/mac/\@address)"); - utf8::encode($mac); - return $mac; -} - -sub get_first_interface_target_dev { - my $dom = shift; - my $targetdev = xpath($dom, "string(/domain/devices/interface[1]/target/\@dev)"); - return $targetdev; -} - -sub get_network_ip { - my $conn = shift; - my $netname = shift; - diag "getting ip for network $netname"; - my $net = $conn->get_network_by_name($netname); - my $net_ip = xpath($net, "string(/network/ip[1]/\@address"); - my $net_mask = xpath($net, "string(/network/ip[1]/\@netmask"); - my $net_prefix = xpath($net, "string(/network/ip[1]/\@prefix"); - my $ip; - - if ($net_mask) { - $ip = NetAddr::IP->new($net_ip, $net_mask); - } elsif ($net_prefix) { - $ip = NetAddr::IP->new("$net_ip/$net_mask"); - } else { - $ip = NetAddr::IP->new("$net_ip"); - } - return $ip; -} - - -sub get_ip_from_leases{ - my $conn = shift; - my $netname = shift; - my $mac = shift; - - my $net = $conn->get_network_by_name($netname); - if ($net->can('get_dhcp_leases')) { - my @leases = $net->get_dhcp_leases($mac); - return @leases ? @leases[0]->{'ipaddr'} : undef; - } - - my $tmp = `grep $mac /var/lib/libvirt/dnsmasq/default.leases`; - my @fields = split(/ /, $tmp); - my $ip = $fields[2]; - return $ip; -} - - -sub shutdown_vm_gracefully { - my $dom = shift; - - my $target = time() + 30; - $dom->shutdown; - while ($dom->is_active()) { - sleep(1); - diag ".. waiting for virtual machine to shutdown.. "; - $dom->destroy() if time() > $target; - } - sleep(1); - diag ".. shutdown complete.. "; -} - -1; diff --git a/scripts/domain/180-interface-parameters.t b/scripts/domain/180-interface-parameters.t index 66c7ed6..b3f0c19 100644 --- a/scripts/domain/180-interface-parameters.t +++ b/scripts/domain/180-interface-parameters.t @@ -33,7 +33,6 @@ use warnings; use Test::More tests => 10;
use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use File::stat;
diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/100-ping-still-working.t index 12f2c7c..a88eb02 100644 --- a/scripts/nwfilter/100-ping-still-working.t +++ b/scripts/nwfilter/100-ping-still-working.t @@ -30,7 +30,6 @@ use warnings; use Test::More tests => 4;
use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception;
use File::Spec::Functions qw(catfile catdir rootdir); diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-no-mac-spoofing.t index 95b1499..87c19e7 100644 --- a/scripts/nwfilter/210-no-mac-spoofing.t +++ b/scripts/nwfilter/210-no-mac-spoofing.t @@ -29,7 +29,6 @@ use warnings; use Test::More tests => 5;
use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use Net::OpenSSH;
diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-no-ip-spoofing.t index a1da6eb..bacb861 100644 --- a/scripts/nwfilter/220-no-ip-spoofing.t +++ b/scripts/nwfilter/220-no-ip-spoofing.t @@ -29,7 +29,6 @@ use warnings; use Test::More tests => 4;
use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use Net::OpenSSH;
diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230-no-mac-broadcast.t index 4254e7c..b518a81 100644 --- a/scripts/nwfilter/230-no-mac-broadcast.t +++ b/scripts/nwfilter/230-no-mac-broadcast.t @@ -29,7 +29,6 @@ use warnings; use Test::More tests => 4;
use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use Net::OpenSSH; use File::Spec::Functions qw(catfile catdir rootdir); diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t index 882a385..77b36d2 100644 --- a/scripts/nwfilter/240-no-arp-spoofing.t +++ b/scripts/nwfilter/240-no-arp-spoofing.t @@ -29,7 +29,6 @@ use warnings; use Test::More tests => 4;
use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use Net::OpenSSH; use File::Spec::Functions qw(catfile catdir rootdir); diff --git a/scripts/nwfilter/300-vsitype.t b/scripts/nwfilter/300-vsitype.t index 90d237f..3af9d4f 100644 --- a/scripts/nwfilter/300-vsitype.t +++ b/scripts/nwfilter/300-vsitype.t @@ -29,7 +29,6 @@ use warnings; use Test::More;
use Sys::Virt::TCK; -use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; use File::Spec::Functions qw(catfile catdir rootdir);

On Fri, Jun 08, 2018 at 11:38:07AM -0400, Laine Stump wrote:
On 06/08/2018 10:55 AM, Daniel P. Berrangé wrote:
The TCK module requires stuff in the NetworkHelpers and also vica-verca. This circular dependancy causes import problems, when trying to use the functions in NetworkHelpers from the TCK module.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
(but see below - there is a pre-existing bug in some code you're moving)
--- MANIFEST | 1 - lib/Sys/Virt/TCK.pm | 71 +++++++++++++++++++++- lib/Sys/Virt/TCK/NetworkHelpers.pm | 72 ----------------------- scripts/domain/180-interface-parameters.t | 1 - scripts/nwfilter/100-ping-still-working.t | 1 - scripts/nwfilter/210-no-mac-spoofing.t | 1 - scripts/nwfilter/220-no-ip-spoofing.t | 1 - scripts/nwfilter/230-no-mac-broadcast.t | 1 - scripts/nwfilter/240-no-arp-spoofing.t | 1 - scripts/nwfilter/300-vsitype.t | 1 - 10 files changed, 70 insertions(+), 81 deletions(-) delete mode 100644 lib/Sys/Virt/TCK/NetworkHelpers.pm
diff --git a/MANIFEST b/MANIFEST index 9338981..79f93c0 100644 --- a/MANIFEST +++ b/MANIFEST
+sub get_network_ip { + my $conn = shift; + my $netname = shift; + diag "getting ip for network $netname"; + my $net = $conn->get_network_by_name($netname); + my $net_ip = xpath($net, "string(/network/ip[1]/\@address"); + my $net_mask = xpath($net, "string(/network/ip[1]/\@netmask"); + my $net_prefix = xpath($net, "string(/network/ip[1]/\@prefix"); + my $ip; + + if ($net_mask) { + $ip = NetAddr::IP->new($net_ip, $net_mask); + } elsif ($net_prefix) { + $ip = NetAddr::IP->new("$net_ip/$net_mask");
Oops! I just noticed a bug in my function that you've moved - that final $net_mask should be $net_prefix. I assume you don't want to just squash that fix into here. Should I wait until you've pushed and send a patch, or ... ???
Yeah better to send a separate patch Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

The source file headers all say GPL and do not mention the Artistic license, likewise the Build.PL file and RPM Spec. Remove bogus references to the Artistic license from the LICENSE file. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- LICENSE | 159 -------------------------------------------------------- 1 file changed, 159 deletions(-) diff --git a/LICENSE b/LICENSE index 2fce945..f8bb166 100644 --- a/LICENSE +++ b/LICENSE @@ -1,18 +1,3 @@ -This program is free software; you can redistribute it and/or modify -it under the terms of either: - -a) the GNU General Public License as published by the Free - Software Foundation; either version 2, or (at your option) any - later version - -or - -b) the "Artistic License" - -The text of both licenses follows below... - ---------------------------------------------------------------------------- - GNU GENERAL PUBLIC LICENSE Version 2, June 1991 @@ -295,147 +280,3 @@ POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ---------------------------------------------------------------------------- - -The "Artistic License" - - Preamble - - The intent of this document is to state the conditions under which a - Package may be copied, such that the Copyright Holder maintains some - semblance of artistic control over the development of the package, - while giving the users of the package the right to use and distribute - the Package in a more-or-less customary fashion, plus the right to make - reasonable modifications. - - Definitions - - "Package" - refers to the collection of files distributed by the Copyright - Holder, and derivatives of that collection of files created through - textual modification. - - "Standard Version" - refers to such a Package if it has not been modified, or has been - modified in accordance with the wishes of the Copyright Holder as - specified below. - - "Copyright Holder" - is whoever is named in the copyright or copyrights for the package. - - "You" - is you, if you're thinking about copying or distributing this Pack- - age. - - "Reasonable copying fee" - is whatever you can justify on the basis of media cost, duplication - charges, time of people involved, and so on. (You will not be - required to justify it to the Copyright Holder, but only to the - computing community at large as a market that must bear the fee.) - - "Freely Available" - means that no fee is charged for the item itself, though there may - be fees involved in handling the item. It also means that recipi- - ents of the item may redistribute it under the same conditions they - received it. - - Conditions - - 1. You may make and give away verbatim copies of the source form of - the Standard Version of this Package without restriction, provided - that you duplicate all of the original copyright notices and asso- - ciated disclaimers. - - 2. You may apply bug fixes, portability fixes and other modifications - derived from the Public Domain or from the Copyright Holder. A - Package modified in such a way shall still be considered the Stan- - dard Version. - - 3. You may otherwise modify your copy of this Package in any way, pro- - vided that you insert a prominent notice in each changed file stat- - ing how and when you changed that file, and provided that you do at - least ONE of the following: - - a) place your modifications in the Public Domain or otherwise make - them Freely Available, such as by posting said modifications to - Usenet or an equivalent medium, or placing the modifications on - a major archive site such as uunet.uu.net, or by allowing the - Copyright Holder to include your modifications in the Standard - Version of the Package. - - b) use the modified Package only within your corporation or orga- - nization. - - c) rename any non-standard executables so the names do not con- - flict with standard executables, which must also be provided, - and provide a separate manual page for each non-standard exe- - cutable that clearly documents how it differs from the Standard - Version. - - d) make other distribution arrangements with the Copyright Holder. - - 4. You may distribute the programs of this Package in object code or - executable form, provided that you do at least ONE of the follow- - ing: - - a) distribute a Standard Version of the executables and library - files, together with instructions (in the manual page or equiv- - alent) on where to get the Standard Version. - - b) accompany the distribution with the machine-readable source of - the Package with your modifications. - - c) give non-standard executables non-standard names, and clearly - document the differences in manual pages (or equivalent), - together with instructions on where to get the Standard Ver- - sion. - - d) make other distribution arrangements with the Copyright Holder. - - 5. You may charge a reasonable copying fee for any distribution of - this Package. You may charge any fee you choose for support of - this Package. You may not charge a fee for this Package itself. - However, you may distribute this Package in aggregate with other - (possibly commercial) programs as part of a larger (possibly com- - mercial) software distribution provided that you do not advertise - this Package as a product of your own. You may embed this Pack- - age's interpreter within an executable of yours (by linking); this - shall be construed as a mere form of aggregation, provided that the - complete Standard Version of the interpreter is so embedded. - - 6. The scripts and library files supplied as input to or produced as - output from the programs of this Package do not automatically fall - under the copyright of this Package, but belong to whoever gener- - ated them, and may be sold commercially, and may be aggregated with - this Package. If such scripts or library files are aggregated with - this Package via the so-called "undump" or "unexec" methods of pro- - ducing a binary executable image, then distribution of such an - image shall neither be construed as a distribution of this Package - nor shall it fall under the restrictions of Paragraphs 3 and 4, - provided that you do not represent such an executable image as a - Standard Version of this Package. - - 7. C subroutines (or comparably compiled subroutines in other lan- - guages) supplied by you and linked into this Package in order to - emulate subroutines and variables of the language defined by this - Package shall not be considered part of this Package, but are the - equivalent of input as in Paragraph 6, provided these subroutines - do not change the language in any way that would cause it to fail - the regression tests for the language. - - 8. Aggregation of this Package with a commercial distribution is - always permitted provided that the use of this Package is embedded; - that is, when no overt attempt is made to make this Package's - interfaces visible to the end user of the commercial distribution. - Such use shall not be construed as a distribution of this Package. - - 9. The name of the Copyright Holder may not be used to endorse or pro- - mote products derived from this software without specific prior - written permission. - - 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES - OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - - The End ---------------------------------------------------------------------------- -- 2.17.0

On 06/08/2018 10:55 AM, Daniel P. Berrangé wrote:
The source file headers all say GPL and do not mention the Artistic license, likewise the Build.PL file and RPM Spec. Remove bogus references to the Artistic license from the LICENSE file.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
So what's the deal with this vs. Patch 2 in v1? Were you originally thinking that you would just make this license like other perl stuff by adding the option of the Artistic License, but then realized you couldn't change the license after the fact or something? At any rate, you know much more about licensing than I do, so I'm sure this is correct :-) Reviewed-by: Laine Stump <laine@laine.org>
--- LICENSE | 159 -------------------------------------------------------- 1 file changed, 159 deletions(-)
diff --git a/LICENSE b/LICENSE index 2fce945..f8bb166 100644 --- a/LICENSE +++ b/LICENSE @@ -1,18 +1,3 @@ -This program is free software; you can redistribute it and/or modify -it under the terms of either: - -a) the GNU General Public License as published by the Free - Software Foundation; either version 2, or (at your option) any - later version - -or - -b) the "Artistic License" - -The text of both licenses follows below... - ---------------------------------------------------------------------------- - GNU GENERAL PUBLIC LICENSE Version 2, June 1991
@@ -295,147 +280,3 @@ POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
---------------------------------------------------------------------------- - -The "Artistic License" - - Preamble - - The intent of this document is to state the conditions under which a - Package may be copied, such that the Copyright Holder maintains some - semblance of artistic control over the development of the package, - while giving the users of the package the right to use and distribute - the Package in a more-or-less customary fashion, plus the right to make - reasonable modifications. - - Definitions - - "Package" - refers to the collection of files distributed by the Copyright - Holder, and derivatives of that collection of files created through - textual modification. - - "Standard Version" - refers to such a Package if it has not been modified, or has been - modified in accordance with the wishes of the Copyright Holder as - specified below. - - "Copyright Holder" - is whoever is named in the copyright or copyrights for the package. - - "You" - is you, if you're thinking about copying or distributing this Pack- - age. - - "Reasonable copying fee" - is whatever you can justify on the basis of media cost, duplication - charges, time of people involved, and so on. (You will not be - required to justify it to the Copyright Holder, but only to the - computing community at large as a market that must bear the fee.) - - "Freely Available" - means that no fee is charged for the item itself, though there may - be fees involved in handling the item. It also means that recipi- - ents of the item may redistribute it under the same conditions they - received it. - - Conditions - - 1. You may make and give away verbatim copies of the source form of - the Standard Version of this Package without restriction, provided - that you duplicate all of the original copyright notices and asso- - ciated disclaimers. - - 2. You may apply bug fixes, portability fixes and other modifications - derived from the Public Domain or from the Copyright Holder. A - Package modified in such a way shall still be considered the Stan- - dard Version. - - 3. You may otherwise modify your copy of this Package in any way, pro- - vided that you insert a prominent notice in each changed file stat- - ing how and when you changed that file, and provided that you do at - least ONE of the following: - - a) place your modifications in the Public Domain or otherwise make - them Freely Available, such as by posting said modifications to - Usenet or an equivalent medium, or placing the modifications on - a major archive site such as uunet.uu.net, or by allowing the - Copyright Holder to include your modifications in the Standard - Version of the Package. - - b) use the modified Package only within your corporation or orga- - nization. - - c) rename any non-standard executables so the names do not con- - flict with standard executables, which must also be provided, - and provide a separate manual page for each non-standard exe- - cutable that clearly documents how it differs from the Standard - Version. - - d) make other distribution arrangements with the Copyright Holder. - - 4. You may distribute the programs of this Package in object code or - executable form, provided that you do at least ONE of the follow- - ing: - - a) distribute a Standard Version of the executables and library - files, together with instructions (in the manual page or equiv- - alent) on where to get the Standard Version. - - b) accompany the distribution with the machine-readable source of - the Package with your modifications. - - c) give non-standard executables non-standard names, and clearly - document the differences in manual pages (or equivalent), - together with instructions on where to get the Standard Ver- - sion. - - d) make other distribution arrangements with the Copyright Holder. - - 5. You may charge a reasonable copying fee for any distribution of - this Package. You may charge any fee you choose for support of - this Package. You may not charge a fee for this Package itself. - However, you may distribute this Package in aggregate with other - (possibly commercial) programs as part of a larger (possibly com- - mercial) software distribution provided that you do not advertise - this Package as a product of your own. You may embed this Pack- - age's interpreter within an executable of yours (by linking); this - shall be construed as a mere form of aggregation, provided that the - complete Standard Version of the interpreter is so embedded. - - 6. The scripts and library files supplied as input to or produced as - output from the programs of this Package do not automatically fall - under the copyright of this Package, but belong to whoever gener- - ated them, and may be sold commercially, and may be aggregated with - this Package. If such scripts or library files are aggregated with - this Package via the so-called "undump" or "unexec" methods of pro- - ducing a binary executable image, then distribution of such an - image shall neither be construed as a distribution of this Package - nor shall it fall under the restrictions of Paragraphs 3 and 4, - provided that you do not represent such an executable image as a - Standard Version of this Package. - - 7. C subroutines (or comparably compiled subroutines in other lan- - guages) supplied by you and linked into this Package in order to - emulate subroutines and variables of the language defined by this - Package shall not be considered part of this Package, but are the - equivalent of input as in Paragraph 6, provided these subroutines - do not change the language in any way that would cause it to fail - the regression tests for the language. - - 8. Aggregation of this Package with a commercial distribution is - always permitted provided that the use of this Package is embedded; - that is, when no overt attempt is made to make this Package's - interfaces visible to the end user of the commercial distribution. - Such use shall not be construed as a distribution of this Package. - - 9. The name of the Copyright Holder may not be used to endorse or pro- - mote products derived from this software without specific prior - written permission. - - 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES - OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - - The End ----------------------------------------------------------------------------

On Fri, Jun 08, 2018 at 11:42:14AM -0400, Laine Stump wrote:
On 06/08/2018 10:55 AM, Daniel P. Berrangé wrote:
The source file headers all say GPL and do not mention the Artistic license, likewise the Build.PL file and RPM Spec. Remove bogus references to the Artistic license from the LICENSE file.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
So what's the deal with this vs. Patch 2 in v1? Were you originally thinking that you would just make this license like other perl stuff by adding the option of the Artistic License, but then realized you couldn't change the license after the fact or something?
Originally I blindly copied the RPM spec change from Fedora, but then I actually went to looked at the code headers and saw the change made in Fedora was in fact wrong.
At any rate, you know much more about licensing than I do, so I'm sure this is correct :-)
Reviewed-by: Laine Stump <laine@laine.org>
--- LICENSE | 159 -------------------------------------------------------- 1 file changed, 159 deletions(-)
diff --git a/LICENSE b/LICENSE index 2fce945..f8bb166 100644 --- a/LICENSE +++ b/LICENSE @@ -1,18 +1,3 @@ -This program is free software; you can redistribute it and/or modify -it under the terms of either: - -a) the GNU General Public License as published by the Free - Software Foundation; either version 2, or (at your option) any - later version - -or - -b) the "Artistic License" - -The text of both licenses follows below... - ---------------------------------------------------------------------------- - GNU GENERAL PUBLIC LICENSE Version 2, June 1991
@@ -295,147 +280,3 @@ POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
---------------------------------------------------------------------------- - -The "Artistic License" - - Preamble - - The intent of this document is to state the conditions under which a - Package may be copied, such that the Copyright Holder maintains some - semblance of artistic control over the development of the package, - while giving the users of the package the right to use and distribute - the Package in a more-or-less customary fashion, plus the right to make - reasonable modifications. - - Definitions - - "Package" - refers to the collection of files distributed by the Copyright - Holder, and derivatives of that collection of files created through - textual modification. - - "Standard Version" - refers to such a Package if it has not been modified, or has been - modified in accordance with the wishes of the Copyright Holder as - specified below. - - "Copyright Holder" - is whoever is named in the copyright or copyrights for the package. - - "You" - is you, if you're thinking about copying or distributing this Pack- - age. - - "Reasonable copying fee" - is whatever you can justify on the basis of media cost, duplication - charges, time of people involved, and so on. (You will not be - required to justify it to the Copyright Holder, but only to the - computing community at large as a market that must bear the fee.) - - "Freely Available" - means that no fee is charged for the item itself, though there may - be fees involved in handling the item. It also means that recipi- - ents of the item may redistribute it under the same conditions they - received it. - - Conditions - - 1. You may make and give away verbatim copies of the source form of - the Standard Version of this Package without restriction, provided - that you duplicate all of the original copyright notices and asso- - ciated disclaimers. - - 2. You may apply bug fixes, portability fixes and other modifications - derived from the Public Domain or from the Copyright Holder. A - Package modified in such a way shall still be considered the Stan- - dard Version. - - 3. You may otherwise modify your copy of this Package in any way, pro- - vided that you insert a prominent notice in each changed file stat- - ing how and when you changed that file, and provided that you do at - least ONE of the following: - - a) place your modifications in the Public Domain or otherwise make - them Freely Available, such as by posting said modifications to - Usenet or an equivalent medium, or placing the modifications on - a major archive site such as uunet.uu.net, or by allowing the - Copyright Holder to include your modifications in the Standard - Version of the Package. - - b) use the modified Package only within your corporation or orga- - nization. - - c) rename any non-standard executables so the names do not con- - flict with standard executables, which must also be provided, - and provide a separate manual page for each non-standard exe- - cutable that clearly documents how it differs from the Standard - Version. - - d) make other distribution arrangements with the Copyright Holder. - - 4. You may distribute the programs of this Package in object code or - executable form, provided that you do at least ONE of the follow- - ing: - - a) distribute a Standard Version of the executables and library - files, together with instructions (in the manual page or equiv- - alent) on where to get the Standard Version. - - b) accompany the distribution with the machine-readable source of - the Package with your modifications. - - c) give non-standard executables non-standard names, and clearly - document the differences in manual pages (or equivalent), - together with instructions on where to get the Standard Ver- - sion. - - d) make other distribution arrangements with the Copyright Holder. - - 5. You may charge a reasonable copying fee for any distribution of - this Package. You may charge any fee you choose for support of - this Package. You may not charge a fee for this Package itself. - However, you may distribute this Package in aggregate with other - (possibly commercial) programs as part of a larger (possibly com- - mercial) software distribution provided that you do not advertise - this Package as a product of your own. You may embed this Pack- - age's interpreter within an executable of yours (by linking); this - shall be construed as a mere form of aggregation, provided that the - complete Standard Version of the interpreter is so embedded. - - 6. The scripts and library files supplied as input to or produced as - output from the programs of this Package do not automatically fall - under the copyright of this Package, but belong to whoever gener- - ated them, and may be sold commercially, and may be aggregated with - this Package. If such scripts or library files are aggregated with - this Package via the so-called "undump" or "unexec" methods of pro- - ducing a binary executable image, then distribution of such an - image shall neither be construed as a distribution of this Package - nor shall it fall under the restrictions of Paragraphs 3 and 4, - provided that you do not represent such an executable image as a - Standard Version of this Package. - - 7. C subroutines (or comparably compiled subroutines in other lan- - guages) supplied by you and linked into this Package in order to - emulate subroutines and variables of the language defined by this - Package shall not be considered part of this Package, but are the - equivalent of input as in Paragraph 6, provided these subroutines - do not change the language in any way that would cause it to fail - the regression tests for the language. - - 8. Aggregation of this Package with a commercial distribution is - always permitted provided that the use of this Package is embedded; - that is, when no overt attempt is made to make this Package's - interfaces visible to the end user of the commercial distribution. - Such use shall not be construed as a distribution of this Package. - - 9. The name of the Copyright Holder may not be used to endorse or pro- - mote products derived from this software without specific prior - written permission. - - 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES - OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - - The End ----------------------------------------------------------------------------
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- lib/Sys/Virt/TCK.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index 60bd136..78d3774 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -1275,7 +1275,7 @@ sub get_ip_from_leases{ my $net = $conn->get_network_by_name($netname); if ($net->can('get_dhcp_leases')) { my @leases = $net->get_dhcp_leases($mac); - return @leases ? @leases[0]->{'ipaddr'} : undef; + return @leases ? $leases[0]->{'ipaddr'} : undef; } my $tmp = `grep $mac /var/lib/libvirt/dnsmasq/default.leases`; -- 2.17.0

On 06/08/2018 10:55 AM, Daniel P. Berrangé wrote:
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
What? You've found a style error in my cargo-cult perl? Astounding!! :-P (My recollection is that I tried several different combinations until I hit on one that worked. I don't perl so good...) Reviewed-by: Laine Stump <laine@laine.org>
--- lib/Sys/Virt/TCK.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm index 60bd136..78d3774 100644 --- a/lib/Sys/Virt/TCK.pm +++ b/lib/Sys/Virt/TCK.pm @@ -1275,7 +1275,7 @@ sub get_ip_from_leases{ my $net = $conn->get_network_by_name($netname); if ($net->can('get_dhcp_leases')) { my @leases = $net->get_dhcp_leases($mac); - return @leases ? @leases[0]->{'ipaddr'} : undef; + return @leases ? $leases[0]->{'ipaddr'} : undef; }
my $tmp = `grep $mac /var/lib/libvirt/dnsmasq/default.leases`;
participants (2)
-
Daniel P. Berrangé
-
Laine Stump