Compare commits

..

104 commits

Author SHA1 Message Date
Jan Macku
c81f8b3540 10.27 2025-12-11 10:27:28 +01:00
Fedora Release Engineering
59989cdcf1 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-24 17:40:40 +00:00
Fedora Release Engineering
90e6e9e2ea Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-17 07:11:18 +00:00
Zbigniew Jędrzejewski-Szmek
100c0bd722 Rebuilt for the bin-sbin merge (2nd attempt)
https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin
2025-01-12 14:31:02 +01:00
Jan Macku
c8559fc150 10.26 2024-08-30 14:36:11 +02:00
Fedora Release Engineering
9b36e39b27 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-18 10:23:44 +00:00
Zbigniew Jędrzejewski-Szmek
0ad1aab965 Rebuilt for the bin-sbin merge
https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin
2024-07-09 12:46:03 +02:00
Jan Macku
8c47980cce 10.25 2024-06-25 09:44:19 +02:00
Jan Macku
c8914f994c 10.24 2024-05-29 13:47:14 +02:00
Jan Macku
ad8da7feda 10.23 2024-04-16 10:45:05 +02:00
Jan Macku
414789841d 10.21 2024-02-07 16:15:54 +01:00
Jan Macku
8adbdb9e07 10.20 2024-01-30 14:08:15 +01:00
Fedora Release Engineering
7752abee23 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-24 22:44:52 +00:00
Fedora Release Engineering
c006ff8d74 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-20 23:06:38 +00:00
Fedora Release Engineering
d99531c1b0 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-20 07:26:30 +00:00
Jan Macku
6eb35fcbcc 10.19 2023-05-05 15:57:25 +02:00
Jan Macku
0627061939 10.18 2023-03-23 10:37:58 +01:00
Jan Macku
2ed7bf1db0 Convert to %autorelease and %autochangelog
[skip changelog]
2023-03-23 10:03:23 +01:00
Fedora Release Engineering
00bcdd18cf Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 13:10:56 +00:00
Jan Macku
32dd2e2fe5 10.17 2022-08-24 10:02:50 +02:00
Fedora Release Engineering
3620bdfb5b Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-21 14:41:01 +00:00
Adam Williamson
83747c72df Drop unnecessary obsoletes
Since initscripts requires these packages anyway, the obsoletes
aren't necessary. They're only useful if you split off a new
subpackage and *don't* have the main package require it, but
you still want it to be installed on updates. In this case,
initscripts requires both initscripts-rename-device and
initscripts-service, so there's no need for them to obsolete
older versions of it.

The initscripts-rename-device obsoletes was somehow messing up
live image creation during the openQA update test (caused the
live image not to include initscripts at all). This fixes that.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2022-02-23 17:25:36 -08:00
Jan Macku
d22d9d9fa5 10.16 2022-02-23 14:56:02 +01:00
Jan Macku
8fcd375eb6 10.15 2022-02-15 08:53:41 +01:00
Jan Macku
1977718793 10.14 2022-01-24 12:33:16 +01:00
Fedora Release Engineering
bc7e32837e - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-20 13:18:41 +00:00
Jan Macku
fa67978555 10.13 2022-01-13 09:17:02 +01:00
Jan Macku
4118d1a47d 10.12 2021-09-03 09:28:50 +02:00
Jan Macku
98deefd061 10.11 2021-08-27 09:58:25 +02:00
Jan Macku
063292249b 10.10 2021-08-26 12:01:42 +02:00
Fedora Release Engineering
e8db6a338d - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-22 08:35:29 +00:00
Jan Macku
78c1837894 10.09 2021-02-15 15:53:51 +01:00
Jan Macku
72516ea425 10.08 2021-02-04 14:48:17 +01:00
Fedora Release Engineering
a7d6b1722d - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 14:22:01 +00:00
Jan Macku
bf408b891a 10.07 2021-01-22 09:10:18 +01:00
Tom Stellard
8b9b6fa983 Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2020-12-19 00:49:40 +00:00
Jan Macku
f682f2cda4 10.06 2020-11-13 10:30:46 +01:00
Jan Macku
dd1b01a7f2 10.05 2020-11-06 09:38:18 +01:00
Fedora Release Engineering
f8e9330962 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-28 01:49:17 +00:00
Jan Macku
16097e4697 10.04 2020-07-17 09:05:08 +02:00
Jan Macku
a6acd3cd5d 10.03 2020-03-25 10:09:06 +01:00
Fedora Release Engineering
20a3a8134f - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-29 05:28:40 +00:00
Fedora Release Engineering
8bc17aea41 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-25 09:32:45 +00:00
Jan Macku
c017856836 10.02 2019-06-28 15:07:03 +02:00
Fedora Release Engineering
a26dfde505 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-01 03:23:13 +00:00
David Kaspar [Dee'Kej]
58901cdc40 10.01 2018-08-06 13:16:24 +02:00
Fedora Release Engineering
99cbd9c275 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-13 05:44:00 +00:00
David Kaspar [Dee'Kej]
b218c70171 10.00 2018-06-21 16:42:17 +02:00
David Kaspar [Dee'Kej]
8f1d188016 specfile: fix failing build because of incorrect use of %{_isa} 2018-06-15 12:36:57 +02:00
David Kaspar [Dee'Kej]
7276c52c2c 9.83 2018-06-14 16:45:12 +02:00
David Kaspar [Dee'Kej]
b401eaeb06 rebase.sh: relative path is now used for the SRPM 2018-06-14 16:42:58 +02:00
David Kaspar [Dee'Kej]
c1a3a2c4c9 rebase.sh updated to do a scratch build before push 2018-06-13 14:24:57 +02:00
David Kaspar [Dee'Kej]
a9bd99de9a README.md updated 2018-06-13 13:52:36 +02:00
David Kaspar [Dee'Kej]
10556b4674 README.md pointing to upstream's description added 2018-06-13 13:51:29 +02:00
David Kaspar [Dee'Kej]
5caa862561 Revert "upstream's README.md added"
This reverts commit 828930f758.
2018-06-13 13:49:27 +02:00
David Kaspar [Dee'Kej]
828930f758 upstream's README.md added 2018-06-13 13:48:17 +02:00
David Kaspar [Dee'Kej]
5d86e6ecbf 9.82 2018-06-04 13:57:59 +02:00
David Kaspar [Dee'Kej]
cc0891ad5a 9.81 2018-06-01 15:09:09 +02:00
David Kaspar [Dee'Kej]
e68a9f6e5b specfile: fix of previous commit (triggerrun removed as intended) 2018-05-25 13:03:17 +02:00
David Kaspar [Dee'Kej]
b49d82372a 9.80 2018-05-25 12:56:09 +02:00
Karel Zak
ece91b6027 remove adjtime from buildroot too 2018-05-18 11:02:43 +02:00
Karel Zak
ec7561937e 9.79-4: move /etc/adjtime to util-linux 2018-05-18 10:46:44 +02:00
Igor Gnatenko
66424e8dfc
Escape macros in %changelog
Reference: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/Y2ZUKK2B7T2IKXPMODNF6HB2O5T5TS6H/
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-09 09:04:44 +01:00
Fedora Release Engineering
19f61713dc - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-07 17:29:31 +00:00
David Kaspar
5c3ed97c09 Merge #1 Add CI tests using the standard test interface 2018-01-05 10:44:48 +00:00
David Kaspar [Dee'Kej]
d98dff205a 9.79 2018-01-02 16:31:51 +01:00
esakaiev
b141ea22e9 Adding cnhages in Sanity-init-scripts-LSB, according to the http://pkgs.devel.redhat.com/cgit/tests/initscripts/commit/ 2017-12-19 19:00:08 +02:00
esakaiev
b847d3463c Removing .gitignore from new_tests branch 2017-12-14 19:41:15 +02:00
esakaiev
6c34f25ae1 Adding initscripts tests to the new-tests branch 2017-12-12 18:50:57 +02:00
esakaiev
73d57eaa5b Initial commit, adding .gitignore to the master branch 2017-12-12 18:49:11 +02:00
David Kaspar [Dee'Kej]
dcade7bff5 9.78 2017-11-09 11:27:23 +01:00
David Kaspar [Dee'Kej]
c155b1dbda 9.77 2017-08-15 14:35:16 +02:00
Zbigniew Jędrzejewski-Szmek
14f11104dd Rebuild after builds with rpm 4.14 were untagged 2017-08-11 06:57:06 -04:00
Zbigniew Jędrzejewski-Szmek
d3caf21a29 Fix compilation on s390x 2017-08-10 15:29:31 -04:00
David Kaspar [Dee'Kej]
8e43169ab0 9.76 2017-08-07 17:02:27 +02:00
David Kaspar [Dee'Kej]
ee6edab6e6 9.75 2017-08-07 14:46:31 +02:00
David Kaspar [Dee'Kej]
eaffb9550b 9.74 2017-08-04 16:53:29 +02:00
Fedora Release Engineering
b6ab9a6dbf - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild 2017-08-02 23:47:46 +00:00
Fedora Release Engineering
c8768ae27b - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-26 13:34:18 +00:00
David Kaspar [Dee'Kej]
243b64adc1 9.72 2017-05-25 17:59:35 +02:00
David Kaspar [Dee'Kej]
a11c2d64d6 9.71 2017-05-25 11:27:59 +02:00
Lukas Nykryn
049c81f2d3 9.70 2017-02-28 10:19:41 +01:00
Fedora Release Engineering
f259f7b866 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-10 16:26:32 +00:00
David Kaspar [Dee'Kej]
37ba55c6e6 9.69-1 2016-08-30 15:43:36 +02:00
David Kaspar [Dee'Kej]
959a96814c 9.68-1 2016-08-09 15:29:15 +02:00
Lukas Nykryn
a14ce69b23 9.67-1 2016-07-19 13:47:24 +02:00
Lukas Nykryn
bd7342c31a 9.66-1 2016-04-25 15:34:39 +02:00
Dennis Gilmore
3713379034 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild 2016-02-04 00:32:09 +00:00
Lukas Nykryn
443c9aaa40 9.65-1 2015-12-07 14:41:15 +01:00
Lukas Nykryn
15694203da 9.64-1 2015-08-06 16:49:01 +02:00
Dennis Gilmore
b68d903213 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 2015-06-17 11:25:01 +00:00
Lukas Nykryn
c777c519e0 9.63-1 2015-05-18 15:13:36 +02:00
Lukas Nykryn
4567b472f6 9.62-1 2015-04-09 16:20:59 +02:00
Lukas Nykryn
53878cc54c 9.61-1 2015-01-26 12:27:06 +01:00
Lukas Nykryn
6ebdb7b94e 9.60-1 2014-12-16 15:48:32 +01:00
Lukas Nykryn
245053800f improve check for bond_master in install bonding driver
Conflicts:
	initscripts.spec
2014-12-08 13:59:57 +01:00
Lukas Nykryn
53f566228b 9.59-1 2014-11-12 13:00:52 +01:00
Lukas Nykryn
a8ac62456e 9.58-1 2014-11-06 11:05:48 +01:00
Lukas Nykryn
fab7fb2c58 9.56.1-2 2014-10-14 19:55:49 -04:00
Zbigniew Jędrzejewski-Szmek
ed75de05f9 9.56.1-1 2014-10-07 23:13:59 -04:00
Zbigniew Jędrzejewski-Szmek
6ee1b79261 Update fedora-import-state 2014-10-06 11:54:07 -04:00
Peter Robinson
8c1e6907e1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild 2014-08-16 21:35:16 +00:00
Lukas Nykryn
80893f4dcc 9.55-1 2014-07-22 14:08:00 +02:00
Tom Callaway
f1984484cc fix license handling 2014-07-12 18:11:16 -04:00
16 changed files with 1462 additions and 427 deletions

52
.gitignore vendored
View file

@ -11,3 +11,55 @@
/initscripts-9.54.tar.bz2
/initscripts-9.55.tar.bz2
/initscripts-9.56.1.tar.bz2
/initscripts-9.58.tar.bz2
/initscripts-9.59.tar.bz2
/initscripts-9.60.tar.bz2
/initscripts-9.61.tar.bz2
/initscripts-9.62.tar.bz2
/initscripts-9.63.tar.bz2
/initscripts-9.64.tar.bz2
/initscripts-9.65.tar.bz2
/initscripts-9.66.tar.bz2
/initscripts-9.67.tar.bz2
/initscripts-9.68.tar.bz2
/initscripts-9.69.tar.bz2
/initscripts-9.70.tar.gz
/initscripts-9.71.tar.gz
/initscripts-9.72.tar.gz
/initscripts-9.74.tar.gz
/initscripts-9.75.tar.gz
/initscripts-9.76.tar.gz
/initscripts-9.77.tar.gz
/initscripts-9.78.tar.gz
/initscripts-9.79.tar.gz
/initscripts-9.80.tar.gz
/initscripts-9.81.tar.gz
/initscripts-9.82.tar.gz
/initscripts-9.83.tar.gz
/initscripts-10.00.tar.gz
/initscripts-10.01.tar.gz
/initscripts-10.02.tar.gz
/initscripts-10.03.tar.gz
/initscripts-10.04.tar.gz
/initscripts-10.05.tar.gz
/initscripts-10.06.tar.gz
/initscripts-10.07.tar.gz
/initscripts-10.08.tar.gz
/initscripts-10.09.tar.gz
/initscripts-10.10.tar.gz
/initscripts-10.11.tar.gz
/initscripts-10.12.tar.gz
/initscripts-10.13.tar.gz
/initscripts-10.14.tar.gz
/initscripts-10.15.tar.gz
/initscripts-10.16.tar.gz
/initscripts-10.17.tar.gz
/initscripts-10.18.tar.gz
/initscripts-10.19.tar.gz
/initscripts-10.20.tar.gz
/initscripts-10.21.tar.gz
/initscripts-10.23.tar.gz
/initscripts-10.24.tar.gz
/initscripts-10.25.tar.gz
/initscripts-10.26.tar.gz
/initscripts-10.27.tar.gz

View file

@ -1,63 +0,0 @@
From 6708502ce8724feb143e5a97af43687cec901c99 Mon Sep 17 00:00:00 2001
From: Laine Stump <laine@redhat.com>
Date: Tue, 11 Nov 2014 14:13:22 -0500
Subject: [PATCH] adjust LINKDELAY when STP is on
This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1162822
When ifup is called on an interface that has BOOTPROTO=dhcp, ifup-eth
will call network-functions:check_link_down() to wait for carrier on
the interface before starting dhclient. If the interface happens to be
a bridge device, carrier will not come on until at least one attached
device is in "forwarding" mode. If the bridge has STP enabled, it
takes at least $DELAY * 2 + 5 seconds (sometimes slightly longer) for
any attached device to go into forwarding mode.
However, check_link_down() will only wait for max(${LINKDELAY}, 5)
seconds for carrier, and there are *many* existing configs that have
STP enabled but no setting for LINKDELAY. Every one of those configs
will now fail to ifup the bridge device.
The solution implemented in this patch is for ifup-eth to set
LINKDELAY to at least ${DELAY} * 2 + 7 when the device is a bridge an
STP is enabled. Since check_link_down() returns within .5 sec of
carrier coming up, the worst effect this could have would be to take
longer to fail in the case of a config where carrier was *never* going
to come up. Otherwise, it will not create any more delay than is
already present in cases that currently work, and will cause many
other configs to become unbroken.
---
sysconfig/network-scripts/ifup-eth | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index c8154dc..1ee026b 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -1,6 +1,6 @@
#!/bin/bash
# Network Interface Configuration System
-# Copyright (c) 1996-2010 Red Hat, Inc. all rights reserved.
+# Copyright (c) 1996-2014 Red Hat, Inc. all rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2,
@@ -64,6 +64,15 @@ if [ "${TYPE}" = "Bridge" ]; then
value=${arg##*=};
echo $value > /sys/class/net/${DEVICE}/bridge/$key
done
+ # set LINKDELAY (used as timeout when calling check_link_down())
+ # to at least (${DELAY} * 2) + 7 if STP is enabled. This is the
+ # minimum time required for /sys/class/net/$REALDEVICE/carrier to
+ # become 1 after "ip link set dev $DEVICE up" is called.
+ if [ "${STP}" = "yes" -o "${STP}" = "on" ]; then
+ TMPD=7
+ [ -n "${DELAY}" ] && TMPD=$(expr ${DELAY} \* 2 + ${TMPD})
+ [ 0$LINKDELAY -lt $TMPD ] && LINKDELAY=$TMPD
+ fi
fi
# Create tap device.
--
1.8.3.1

View file

@ -1,24 +0,0 @@
From 7e548d51df2b8df098bc7584ad75258ac7064509 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Tue, 16 Dec 2014 14:12:36 +0100
Subject: [PATCH] ifdown-ipv6: reset addrgenmode to eui64 for device
---
sysconfig/network-scripts/ifdown-ipv6 | 1 +
1 file changed, 1 insertion(+)
diff --git a/sysconfig/network-scripts/ifdown-ipv6 b/sysconfig/network-scripts/ifdown-ipv6
index 7bfcfb3..d2207b7 100755
--- a/sysconfig/network-scripts/ifdown-ipv6
+++ b/sysconfig/network-scripts/ifdown-ipv6
@@ -66,6 +66,7 @@ fi
/sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.forwarding=0 >/dev/null 2>&1
/sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.accept_ra=0 >/dev/null 2>&1
/sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.accept_redirects=0 >/dev/null 2>&1
+/sbin/ip link set $DEVICE addrgenmode eui64 >/dev/null 2>&1
# Test status of tun6to4 device
ipv6_test_device_status tun6to4
--
1.8.3.1

View file

@ -1,25 +0,0 @@
From 2444fc5a4060e4f78059b1bff9fa37a10b6fd648 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Tue, 16 Dec 2014 12:14:08 +0100
Subject: [PATCH] ifup: fix typo
---
sysconfig/network-scripts/ifup | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index 911707e..bb58685 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -90,7 +90,7 @@ if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ] && [ -n $DEVICE ]; then
fi
MATCH='^vlan[0-9]{1,4}?'
if [[ "${DEVICE}" =~ $MATCH ]]; then
- VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//'):
+ VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//')
# PHYSDEV should be set in ifcfg-vlan* file
if test -z "$PHYSDEV"; then
net_log $"PHYSDEV should be set for device ${DEVICE}"
--
1.8.3.1

View file

@ -1,25 +0,0 @@
From ca531a88a9dfb8675a908bae8af49e81f061baef Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Tue, 8 Jul 2014 13:18:29 +0200
Subject: [PATCH] ifup,vlan: fix typo
---
sysconfig/network-scripts/ifup | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index f2a1c8f..911707e 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -76,7 +76,7 @@ fi
# Ethernet 802.1Q VLAN support
if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ] && [ -n $DEVICE ]; then
- if [ -n ${VID} ]; then
+ if [ -n "${VID}" ]; then
if test -z "$PHYSDEV"; then
net_log $"PHYSDEV should be set for device ${DEVICE}"
exit 1
--
1.8.3.1

View file

@ -1,56 +0,0 @@
From 30ecd15eb772de10f9c2f94cc9bad4eac5439d24 Mon Sep 17 00:00:00 2001
From: Ashish Samant <ashish.samant@oracle.com>
Date: Wed, 29 Oct 2014 17:47:29 -0700
Subject: [PATCH] improve_check_for_bond_master_in_install_bonding_driver
The current grep check (fgrep -sqx) in install_bonding_driver, to determine
whether bond master exists, fails when there are multiple bond masters.
The fix assumes that multiple bond masters are on different lines in the file
"/sys/class/net/bonding_masters", while they are in fact on the same line.
Since fgrep -sqx checks for the entire line,it will never match any one bond
master within the line and always fail if there are multiple bonds.
This patch improves the check by creating a new function, bond_master_exists()
to handle this and other conditions.
Orabug: 19897586
Signed-off-by: Ashish Samant <ashish.samant@oracle.com>
Signed-off-by: John Haxby <john.haxby@oracle.com>
Acked-by: Mukesh Kacker <mukesh.kacker@oracle.com>
---
sysconfig/network-scripts/network-functions | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 0e86efd..e6273bb 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -458,10 +458,22 @@ phy_wireless_device ()
cat /sys/class/net/$1/phy80211/name
}
+bond_master_exists ()
+{
+ local bond_name
+ [ -z "${1}" ] && return 1
+ [ ! -f /sys/class/net/bonding_masters ] && return 1
+
+ for bond_name in $(< /sys/class/net/bonding_masters); do
+ [ "${bond_name}" == "${1}" ] && return 0
+ done
+ return 1
+}
+
install_bonding_driver ()
{
- [ ! -f /sys/class/net/bonding_masters ] && ( modprobe bonding || return 1 )
- if ! fgrep -sqx "$1" /sys/class/net/bonding_masters; then
+ if ! bond_master_exists ${1}; then
+ modprobe bonding || return 1
echo "+$1" > /sys/class/net/bonding_masters 2>/dev/null
fi
(
--
1.8.3.1

View file

@ -1,38 +0,0 @@
From 1f230a3d2e2733e30577c91645005801ab2c0f40 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Mon, 12 Jan 2015 12:49:46 +0100
Subject: [PATCH] network-functions: is_available_wait should wait even in the
case that is_available returns 2
---
sysconfig/network-scripts/network-functions | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 1ecbcfc..9a5e359 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -336,18 +336,16 @@ is_available_wait ()
local retry=${2##*[!0-9]*}
- is_available $1
+ is_available $1 && return 0
ret=$?
- [ 0"$ret" -ne 1 ] && return $ret
-
while [ 0"$retry" -gt 0 ]; do
sleep 1
[ -d "/sys/class/net/$1" ] && return 0
retry=$(($retry -1))
done
- return 1
+ return $ret
}
need_hostname ()
--
1.8.3.1

3
README.md Normal file
View file

@ -0,0 +1,3 @@
# Additional information
Check upstream's [README.md](https://github.com/fedora-sysv/initscripts/blob/master/README.md) for more info.

File diff suppressed because it is too large Load diff

29
rebase.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
# We always do a rebase to new upstream's tarball for Fedora Rawhide.
#
# For non-Rawhide Fedora releases, we can sometimes backport specific patches,
# if the rebase is not possible.
#
# This scripts automates this process.
# Since we are operating in a dist-git repository where we can't fix things with
# --force-push if something goes wrong, we need to be extra careful and exit
# immediately if something fails.
set -e
curl https://raw.githubusercontent.com/fedora-sysv/initscripts/master/initscripts.spec -o initscripts.spec || exit 1
spectool -g initscripts.spec
# Make a local scratch build in mock first. If it fails, do not upload new tarball!
# srpm_file="$(basename $(fedpkg srpm | grep -i "wrote" | cut -d ':' -f 2))"
# arch="$(uname -p)"
# mock -r "fedora-rawhide-${arch}" "${srpm_file}" || exit 2
# Scratch build passed, the build should pass in Koji as well. Let's proceed:
fedpkg new-sources "$(basename $(spectool -S -l initscripts.spec | gawk '{print $2;}'))" || exit 3
git add initscripts.spec
git commit -m "$(grep Version initscripts.spec | gawk '{print $2;}')"
git show

View file

@ -1 +1 @@
8ca2abb3877e8019a5e726c25501e8e3 initscripts-9.56.1.tar.bz2
SHA512 (initscripts-10.27.tar.gz) = 951f88158eaf7409f7d65c9875c9ba2611e6a805c17112ddbb34167a1638d87d2433c3962d20e66564669f3424dd7be1265cbe03a1a7d6b1c5413ed43d80148d

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/initscripts/Sanity/init-scripts-LSB
# Description: Init scripts should meet LSB specifications
# Author: Yulia Kopkova <ykopkova@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/initscripts/Sanity/init-scripts-LSB
export TESTVERSION=1.4
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Jan Scotka <jscotka@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Init scripts should meet LSB specifications" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: initscripts" >> $(METADATA)
@echo "Requires: initscripts" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: RedHatEnterpriseLinux6" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/initscripts/Sanity/init-scripts-LSB
Description: Init scripts should meet LSB specifications
Author: Yulia Kopkova <ykopkova@redhat.com>

View file

@ -0,0 +1,228 @@
#!/bin/bash
# vim: dict=/usr/share/rhts-library/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/initscripts/Sanity/init-scripts-LSB
# Description: Init scripts should meet LSB specifications
# Author: Jan Scotka <jscotka@redhat.com>, Yulia Kopkova <ykopkova@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/share/rhts-library/rhtslib.sh
PACKAGE="initscripts"
SRV_NETCONSOLE=netconsole
SRV_NETFS=netfs
TRG_REMOTEFS=remote-fs.target
SRV_NETWORK=network
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "useradd testuserqa" 0 "Add test user"
rlFileBackup /etc/sysconfig/netconsole
if rlIsRHEL '<7'; then #there is no syslog in rhel7 and highier
rlRun "sed -i -e 's,^# SYSLOGADDR=,SYSLOGADDR=redhat.com,' /etc/sysconfig/netconsole" 0 "Set remote syslog server address /etc/sysconfig/netconsole"
fi
rlPhaseEnd
rlPhaseStartTest "netconsole service LSB compliance test"
if ls /lib*/modules/*/kernel/drivers/net/netconsole.ko*; then
rlRun "ls /lib*/modules/*/kernel/drivers/net/netconsole.ko*" 0
if rlIsRHEL '<7'; then
SERVICE=$SRV_NETCONSOLE
rlServiceStop $SERVICE
rlLog ">>>>>>>>> service start"
rlRun "service $SERVICE start" 0 " Service must start without problem "
rlRun "service $SERVICE status" 0 " Then Status command "
rlRun "service $SERVICE start" 0 " Already started service "
rlRun "service $SERVICE status" 0 " Again status command "
rlLog ">>>>>>>>> service restart"
rlRun "service $SERVICE restart" 0 " Restarting of service "
rlRun "service $SERVICE status" 0 " Status command "
rlLog ">>>>>>>>> service stop"
rlRun "service $SERVICE stop" 0 " Stopping service "
rlRun "service $SERVICE status" 3 " Status of stopped service "
rlRun "service $SERVICE stop" 0 " Stopping service again "
rlRun "service $SERVICE status" 3 " Status of stopped service "
rlLog ">>>>>>>>> insufficient rights"
rlRun "service $SERVICE start " 0 " Starting service for restarting under nonpriv user "
rlRun "su testuserqa -c 'service $SERVICE restart'" 1 "Insufficient rights, restarting resrvice under nonprivileged user must fail "
rlLog ">>>>>>>>> operations"
rlServiceStop $SERVICE
rlRun "service $SERVICE start" 0 " Service have to implement start function "
rlRun "service $SERVICE restart" 0 " Service have to implement restart function "
rlRun "service $SERVICE status" 0 " Service have to implement status function "
rlRun "service $SERVICE condrestart" 0 " Service have to implement condrestart function "
rlRun "service $SERVICE reload" 0 " Service have to implement reload function "
rlRun "service $SERVICE force-reload" 0 " Service have to implement force-reload function "
rlLog ">>>>>>>>> nonexist operations"
rlRun "service $SERVICE noexistop" 2 " Testing proper return code when nonexisting function "
rlServiceRestore $SERVICE
fi # rhel 6 or less
else
rlLog ">>>> no netconsole kernel module appear here"
rlRun "ls /lib*/modules/*/kernel/drivers/net/netconsole.ko*" 1,2
fi
rlLog "NIC should support polling, NETPOLL should be compliled in kernel and netconsole module should be loaded"
rlLog "`cat /usr/src/kernels/$(uname -r)/.config | grep -i poll`"
rlLog "netconsole module: `lsmod | grep -i netconsole && echo true || echo false`"
rlLog "`cat /var/log/messages | grep -i netconsole | tail -n 10`"
rlPhaseEnd
# for RHEL6 and lower
if rlIsRHEL '<7'; then
rlPhaseStartTest "netfs service LSB compliance test"
SERVICE=$SRV_NETFS
rlServiceStop $SERVICE
rlLog ">>>>>>>>> service start"
rlRun "service $SERVICE start" 0 " Service must start without problem "
rlRun "service $SERVICE status" 0 " Then Status command "
rlRun "service $SERVICE start" 0 " Already started service "
rlRun "service $SERVICE status" 0 " Again status command "
rlLog ">>>>>>>>> service restart"
rlRun "service $SERVICE restart" 0 " Restarting of service "
rlRun "service $SERVICE status" 0 " Status command "
rlLog ">>>>>>>>> service stop"
rlRun "service $SERVICE stop" 0 " Stopping service "
rlRun "service $SERVICE status" 3 " Status of stopped service "
rlRun "service $SERVICE stop" 0 " Stopping service again "
rlRun "service $SERVICE status" 3 " Status of stopped service "
rlLog ">>>>>>>>> insufficient rights"
rlRun "service $SERVICE start " 0 " Starting service for restarting under nonpriv user "
rlRun "su testuserqa -c 'service $SERVICE restart'" 4 "Insufficient rights, restarting resrvice under nonprivileged user must fail "
rlLog ">>>>>>>>> operations"
rlServiceStop $SERVICE
rlRun "service $SERVICE start" 0 " Service have to implement start function "
rlRun "service $SERVICE restart" 0 " Service have to implement restart function "
rlRun "service $SERVICE status" 0 " Service have to implement status function "
rlLog ">>>>>>>>> nonexist operations"
rlRun "service $SERVICE noexistop" 2 " Testing proper return code when nonexisting function "
rlServiceRestore $SERVICE
rlPhaseEnd
else
rlPhaseStartTest "remote-fs target LSB compliance test"
TARGET=$TRG_REMOTEFS
rlServiceStop $TARGET
rlLog ">>>>>>>>> target start"
rlRun "service $TARGET start" 0 " Target must start without problem "
rlRun "service $TARGET status" 0 " Then Status command "
rlRun "service $TARGET start" 0 " Already started target "
rlRun "service $TARGET status" 0 " Again status command "
rlLog ">>>>>>>>> target restart"
rlRun "service $TARGET restart" 0 " Restarting target "
rlRun "service $TARGET status" 0 " Status command "
rlLog ">>>>>>>>> target stop"
rlRun "service $TARGET stop" 0 " Stopping target "
rlRun "service $TARGET status" 3 " Status of stopped target "
rlRun "service $TARGET stop" 0 " Stopping target again "
rlRun "service $TARGET status" 3 " Status of stopped target "
rlLog ">>>>>>>>> insufficient rights"
rlRun "service $TARGET start " 0 " Starting target for restarting under nonpriv user "
rlRun "su testuserqa -c 'service $TARGET restart'" 1 " Insufficient rights, restarting target under nonprivileged user must fail " # returns 1 instead of 4 because of polkit
rlLog ">>>>>>>>> operations"
rlServiceStop $TARGET
rlRun "service $TARGET start" 0 " Target have to implement start function "
rlRun "service $TARGET restart" 0 " Target have to implement restart function "
rlRun "service $TARGET status" 0 " Target have to implement status function "
rlLog ">>>>>>>>> nonexist operations"
rlRun "service $TARGET noexistop" 2 " Testing proper return code when nonexisting function "
rlServiceRestore $TARGET
rlPhaseEnd
fi
# rlPhaseStartTest "$SRV_NETWORK service LSB compliance test"
#
# SERVICE=$SRV_NETWORK
# rlServiceStop $SERVICE
# rlLog ">>>>>>>>> service start"
# rlRun "service $SERVICE start" 0 " Service must start without problem "
# rlRun "service $SERVICE status" 0 " Then Status command "
# rlRun "service $SERVICE start" 1,0 " Already started service "
# rlRun "service $SERVICE status" 0 " Again status command "
# rlLog ">>>>>>>>> service restart"
# rlRun "service $SERVICE restart" 0 " Restarting of service "
# rlRun "service $SERVICE status" 0 " Status command "
# rlLog ">>>>>>>>> service stop"
# rlRun "service $SERVICE stop" 0 " Stopping service "
# rlRun "service $SERVICE status" 0 " Status of stopped service "
# rlRun "service $SERVICE stop" 0 " Stopping service again "
# rlRun "service $SERVICE status" 0 " Status of stopped service "
# rlLog ">>>>>>>>> insufficient rights"
# rlRun "service $SERVICE start " 0 " Starting service for restarting under nonpriv user "
# rlRun "su testuserqa -c 'service $SERVICE restart'" 4 "Insufficient rights, restarting resrvice under nonprivileged user must fail "
# rlLog ">>>>>>>>> operations"
# rlServiceStop $SERVICE
# rlRun "service $SERVICE start" 0 " Service have to implement start function "
# rlRun "service $SERVICE restart" 0 " Service have to implement restart function "
# rlRun "service $SERVICE status" 0 " Service have to implement status function "
# rlRun "service $SERVICE reload" 0 " Service have to implement reload function "
# rlRun "service $SERVICE force-reload" 0 " Service have to implement force-reload function "
# rlLog ">>>>>>>>> nonexist operations"
# rlRun "service $SERVICE noexistop" 2 " Testing proper return code when nonexisting function "
# rlServiceRestore $SERVICE
# service $SERVICE start
rlPhaseEnd
rlPhaseStartCleanup
rlRun "userdel -fr testuserqa" 0 "Remove test user"
rlFileRestore
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

291
tests/standard-inventory-qcow2 Executable file
View file

@ -0,0 +1,291 @@
#!/usr/bin/env python
import argparse
import errno
import json
import os
import shutil
import shlex
import signal
import socket
import subprocess
import sys
import tempfile
import time
import distutils.util
IDENTITY = """
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA1DrTSXQRF8isQQfPfK3U+eFC4zBrjur+Iy15kbHUYUeSHf5S
jXPYbHYqD1lHj4GJajC9okle9rykKFYZMmJKXLI6987wZ8vfucXo9/kwS6BDAJto
ZpZSj5sWCQ1PI0Ce8CbkazlTp5NIkjRfhXGP8mkNKMEhdNjaYceO49ilnNCIxhpb
eH5dH5hybmQQNmnzf+CGCCLBFmc4g3sFbWhI1ldyJzES5ZX3ahjJZYRUfnndoUM/
TzdkHGqZhL1EeFAsv5iV65HuYbchch4vBAn8jDMmHh8G1ixUCL3uAlosfarZLLyo
3HrZ8U/llq7rXa93PXHyI/3NL/2YP3OMxE8baQIDAQABAoIBAQCxuOUwkKqzsQ9W
kdTWArfj3RhnKigYEX9qM+2m7TT9lbKtvUiiPc2R3k4QdmIvsXlCXLigyzJkCsqp
IJiPEbJV98bbuAan1Rlv92TFK36fBgC15G5D4kQXD/ce828/BSFT2C3WALamEPdn
v8Xx+Ixjokcrxrdeoy4VTcjB0q21J4C2wKP1wEPeMJnuTcySiWQBdAECCbeZ4Vsj
cmRdcvL6z8fedRPtDW7oec+IPkYoyXPktVt8WsQPYkwEVN4hZVBneJPCcuhikYkp
T3WGmPV0MxhUvCZ6hSG8D2mscZXRq3itXVlKJsUWfIHaAIgGomWrPuqC23rOYCdT
5oSZmTvFAoGBAPs1FbbxDDd1fx1hisfXHFasV/sycT6ggP/eUXpBYCqVdxPQvqcA
ktplm5j04dnaQJdHZ8TPlwtL+xlWhmhFhlCFPtVpU1HzIBkp6DkSmmu0gvA/i07Z
pzo5Z+HRZFzruTQx6NjDtvWwiXVLwmZn2oiLeM9xSqPu55OpITifEWNjAoGBANhH
XwV6IvnbUWojs7uiSGsXuJOdB1YCJ+UF6xu8CqdbimaVakemVO02+cgbE6jzpUpo
krbDKOle4fIbUYHPeyB0NMidpDxTAPCGmiJz7BCS1fCxkzRgC+TICjmk5zpaD2md
HCrtzIeHNVpTE26BAjOIbo4QqOHBXk/WPen1iC3DAoGBALsD3DSj46puCMJA2ebI
2EoWaDGUbgZny2GxiwrvHL7XIx1XbHg7zxhUSLBorrNW7nsxJ6m3ugUo/bjxV4LN
L59Gc27ByMvbqmvRbRcAKIJCkrB1Pirnkr2f+xx8nLEotGqNNYIawlzKnqr6SbGf
Y2wAGWKmPyEoPLMLWLYkhfdtAoGANsFa/Tf+wuMTqZuAVXCwhOxsfnKy+MNy9jiZ
XVwuFlDGqVIKpjkmJyhT9KVmRM/qePwgqMSgBvVOnszrxcGRmpXRBzlh6yPYiQyK
2U4f5dJG97j9W7U1TaaXcCCfqdZDMKnmB7hMn8NLbqK5uLBQrltMIgt1tjIOfofv
BNx0raECgYEApAvjwDJ75otKz/mvL3rUf/SNpieODBOLHFQqJmF+4hrSOniHC5jf
f5GS5IuYtBQ1gudBYlSs9fX6T39d2avPsZjfvvSbULXi3OlzWD8sbTtvQPuCaZGI
Df9PUWMYZ3HRwwdsYovSOkT53fG6guy+vElUEDkrpZYczROZ6GUcx70=
-----END RSA PRIVATE KEY-----
"""
USER_DATA = """#cloud-config
users:
- default
- name: root
groups: sudo
shell: /bin/bash
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUOtNJdBEXyKxBB898rdT54ULjMGuO6v4jLXmRsdRhR5Id/lKNc9hsdioPWUePgYlqML2iSV72vKQoVhkyYkpcsjr3zvBny9+5xej3+TBLoEMAm2hmllKPmxYJDU8jQJ7wJuRrOVOnk0iSNF+FcY/yaQ0owSF02Nphx47j2KWc0IjGGlt4fl0fmHJuZBA2afN/4IYIIsEWZziDewVtaEjWV3InMRLllfdqGMllhFR+ed2hQz9PN2QcapmEvUR4UCy/mJXrke5htyFyHi8ECfyMMyYeHwbWLFQIve4CWix9qtksvKjcetnxT+WWrutdr3c9cfIj/c0v/Zg/c4zETxtp standard-test-qcow2
ssh_pwauth: True
chpasswd:
list: |
root:foobar
expire: False
runcmd:
- mkfs.ext4 /dev/sdb
- mount /dev/sdb /usr/local
- sudo mount -o remount,rw /usr
- mkdir /expected /output
"""
def main(argv):
parser = argparse.ArgumentParser(description="Inventory for a QCow2 test image")
parser.add_argument("--list", action="store_true", help="Verbose output")
parser.add_argument('--host', help="Get host variables")
parser.add_argument("subjects", nargs="*", default=shlex.split(os.environ.get("TEST_SUBJECTS", "")))
opts = parser.parse_args()
try:
if opts.host:
data = host(opts.host)
else:
data = list(opts.subjects)
sys.stdout.write(json.dumps(data, indent=4, separators=(',', ': ')))
except RuntimeError as ex:
sys.stderr.write("{0}: {1}\n".format(os.path.basename(sys.argv[0]), str(ex)))
return 1
return 0
def list(subjects):
hosts = []
variables = {}
for subject in subjects:
if subject.endswith((".qcow2", ".qcow2c")):
vars = host(subject)
if vars:
hosts.append(subject)
variables[subject] = vars
return {"localhost": {"hosts": hosts, "vars": {}}, "subjects": {"hosts": hosts, "vars": {}},
"_meta": {"hostvars": variables}}
def start_qemu(image, cloudinit, log, disk_directory=None, disk_size=None, portrange=(2222, 5555)):
for port in xrange(*portrange):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
try:
sock.bind(("127.0.0.3", port))
if disk_size:
return subprocess.Popen(["/usr/bin/qemu-system-x86_64", "-m", "1024", image,
"-enable-kvm", "-snapshot", "-cdrom", cloudinit,
"-hdb", disk_directory,
"-net", "nic,model=virtio", "-net",
"user,hostfwd=tcp:127.0.0.3:{0}-:22".format(port),
"-device", "isa-serial,chardev=pts2", "-chardev", "file,id=pts2,path=" + log,
"-display", "none"], stdout=open(os.devnull, 'w')), port
else:
return subprocess.Popen(["/usr/bin/qemu-system-x86_64", "-m", "1024", image,
"-enable-kvm", "-snapshot", "-cdrom", cloudinit,
"-net", "nic,model=virtio", "-net",
"user,hostfwd=tcp:127.0.0.3:{0}-:22".format(port),
"-device", "isa-serial,chardev=pts2", "-chardev", "file,id=pts2,path=" + log,
"-display", "none"], stdout=open(os.devnull, 'w')), port
except IOError:
pass
finally:
sock.close()
else:
raise RuntimeError("unable to find free local port to map SSH to")
def host(image):
null = open(os.devnull, 'w')
try:
tty = os.open("/dev/tty", os.O_WRONLY)
os.dup2(tty, 2)
except OSError:
tty = None
pass
# A directory for temporary stuff
directory = tempfile.mkdtemp(prefix="inventory-cloud")
identity = os.path.join(directory, "identity")
with open(identity, 'w') as f:
f.write(IDENTITY)
os.chmod(identity, 0o600)
metadata = os.path.join(directory, "meta-data")
with open(metadata, 'w') as f:
f.write("")
userdata = os.path.join(directory, "user-data")
with open(userdata, 'w') as f:
f.write(USER_DATA)
# Create additional disk
disk_size = None
disk_directory = None
try:
disk_size = os.environ.get("EXTEND_DISK_SIZE")
if disk_size:
sys.stderr.write("\nCreate additional cloud init disk DISK SIZE {}\n".format(disk_size))
disk_directory = "{}/atomic-host-disk2-{}".format(directory, disk_size)
subprocess.check_call(["qemu-img", "create", "-f", "qcow2", disk_directory, disk_size], stdout=null)
except KeyError:
sys.stderr.write("\nCouldn't create additional cloud init disk DISK SIZE\n")
pass
# Create our cloud init so we can log in
cloudinit = os.path.join(directory, "cloud-init.iso")
subprocess.check_call(["/usr/bin/genisoimage", "-input-charset", "utf-8",
"-volid", "cidata", "-joliet", "-rock", "-quiet",
"-output", cloudinit, userdata, metadata], stdout=null)
# Determine if virtual machine should be kept available for diagnosis after completion
try:
diagnose = distutils.util.strtobool(os.getenv("TEST_DEBUG", "0"))
except ValueError:
diagnose = 0
sys.stderr.write("Launching virtual machine for {0}\n".format(image))
# And launch the actual VM
artifacts = os.environ.get("TEST_ARTIFACTS", os.path.join(os.getcwd(), "artifacts"))
try:
os.makedirs(artifacts)
except OSError as exc:
if exc.errno != errno.EEXIST or not os.path.isdir(artifacts):
raise
log = os.path.join(artifacts, "{0}.log".format(os.path.basename(image)))
proc = None # for failure detection
cpe = None # for exception scoping
for tries in xrange(0, 5):
try:
proc, port = start_qemu(image, cloudinit, log, disk_directory=disk_directory, disk_size=disk_size)
break
except subprocess.CalledProcessError as cpe:
time.sleep(1)
continue
if proc is None:
raise RuntimeError("Could not launch VM for qcow2 image"
" '{0}':{1}".format(image, cpe.output))
# The variables
variables = {"ansible_ssh_port": "{0}".format(port),
"ansible_ssh_host": "127.0.0.3",
"ansible_ssh_user": "root",
"ansible_ssh_pass": "foobar",
"ansible_ssh_private_key_file": identity,
"ansible_ssh_common_args": "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"}
# Write out a handy inventory file, for our use and for debugging
args = " ".join(["{0}='{1}'".format(*item) for item in variables.items()])
inventory = os.path.join(directory, "inventory")
with open(inventory, "w") as f:
f.write("[subjects]\nlocalhost {1}\n".format(image, args))
# Wait for ssh to come up
ping = ["/usr/bin/ansible", "--inventory", inventory, "localhost", "--module-name", "raw", "--args", "/bin/true"]
for tries in xrange(0, 30):
try:
(pid, ret) = os.waitpid(proc.pid, os.WNOHANG)
if pid != 0:
raise RuntimeError("qemu failed to launch qcow2 image: {0}".format(image))
subprocess.check_call(ping, stdout=null, stderr=null)
break
except subprocess.CalledProcessError:
time.sleep(3)
else:
# Kill the qemu process
try:
os.kill(proc.pid, signal.SIGTERM)
except OSError:
pass
raise RuntimeError("could not access launched qcow2 image: {0}".format(image))
# Process of our parent
ppid = os.getppid()
child = os.fork()
if child:
return variables
# Daemonize and watch the processes
os.chdir("/")
os.setsid()
os.umask(0)
if tty is None:
tty = null.fileno()
# Duplicate standard input to standard output and standard error.
os.dup2(null.fileno(), 0)
os.dup2(tty, 1)
os.dup2(tty, 2)
# Now wait for the parent process to go away, then kill the VM
while True:
time.sleep(3)
try:
os.kill(ppid, 0)
os.kill(proc.pid, 0)
except OSError:
break # Either of the processes no longer exist
if diagnose:
sys.stderr.write("\n")
sys.stderr.write("DIAGNOSE: ssh -p {0} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "
"root@{1} # password: {2}\n".format(port, "127.0.0.3", "foobar"))
sys.stderr.write("DIAGNOSE: export ANSIBLE_INVENTORY={0}\n".format(inventory))
sys.stderr.write("DIAGNOSE: kill {0} # when finished\n".format(os.getpid()))
def _signal_handler(*args):
sys.stderr.write("\nDIAGNOSE ending...\n")
signal.signal(signal.SIGTERM, _signal_handler)
signal.pause()
# Kill the qemu process
try:
os.kill(proc.pid, signal.SIGTERM)
except OSError:
pass
shutil.rmtree(directory)
sys.exit(0)
if __name__ == '__main__':
sys.exit(main(sys.argv))

12
tests/tests.yml Normal file
View file

@ -0,0 +1,12 @@
---
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
- container
- atomic
tests:
- Sanity-init-scripts-LSB
required_packages:
- initscripts