mirror of https://github.com/apache/cloudstack.git
Replace deprecated 'egrep' commands with 'grep -E'. (#12306)
Co-authored-by: Sander Grendelman <sander.grendelman@axians.com>
This commit is contained in:
parent
e0c13cc3ec
commit
5bf869c803
|
|
@ -140,7 +140,7 @@ public class KVMHostInfo {
|
||||||
long speed = 0L;
|
long speed = 0L;
|
||||||
LOGGER.info("Fetching CPU speed from command \"lscpu\".");
|
LOGGER.info("Fetching CPU speed from command \"lscpu\".");
|
||||||
try {
|
try {
|
||||||
String command = "lscpu | grep -i 'Model name' | head -n 1 | egrep -o '[[:digit:]].[[:digit:]]+GHz' | sed 's/GHz//g'";
|
String command = "lscpu | grep -i 'Model name' | head -n 1 | grep -E -o '[[:digit:]].[[:digit:]]+GHz' | sed 's/GHz//g'";
|
||||||
if(isHostS390x()) {
|
if(isHostS390x()) {
|
||||||
command = "lscpu | grep 'CPU dynamic MHz' | cut -d ':' -f 2 | tr -d ' ' | awk '{printf \"%.1f\\n\", $1 / 1000}'";
|
command = "lscpu | grep 'CPU dynamic MHz' | cut -d ':' -f 2 | tr -d ' ' | awk '{printf \"%.1f\\n\", $1 / 1000}'";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
for i in `xm list | awk '{ print $1 }' | egrep -v "Name|Domain-0"`
|
for i in `xm list | awk '{ print $1 }' | grep -E -v "Name|Domain-0"`
|
||||||
do
|
do
|
||||||
xm destroy $i
|
xm destroy $i
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
for i in `xm list | awk '{ print $1 }' | egrep -v "Name|Domain-0"`
|
for i in `xm list | awk '{ print $1 }' | grep -E -v "Name|Domain-0"`
|
||||||
do
|
do
|
||||||
xm destroy $i
|
xm destroy $i
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ while true; do
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "$(date): Doing a recan to make sure we have proper current size locally"
|
echo "$(date): Doing a recan to make sure we have proper current size locally"
|
||||||
for device in $(multipath -ll 3${WWID} | egrep '^ ' | awk '{print $2}'); do
|
for device in $(multipath -ll 3${WWID} | grep -E '^ ' | awk '{print $2}'); do
|
||||||
echo "1" > /sys/bus/scsi/drivers/sd/${device}/rescan;
|
echo "1" > /sys/bus/scsi/drivers/sd/${device}/rescan;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ systemctl is-active multipathd || systemctl restart multipathd || {
|
||||||
|
|
||||||
logger -t "CS_SCSI_VOL_RESIZE" "${WWID} resizing disk path at /dev/mapper/3${WWID} STARTING"
|
logger -t "CS_SCSI_VOL_RESIZE" "${WWID} resizing disk path at /dev/mapper/3${WWID} STARTING"
|
||||||
|
|
||||||
for device in $(multipath -ll 3${WWID} | egrep '^ ' | awk '{print $2}'); do
|
for device in $(multipath -ll 3${WWID} | grep -E '^ ' | awk '{print $2}'); do
|
||||||
echo "1" > /sys/bus/scsi/drivers/sd/${device}/rescan;
|
echo "1" > /sys/bus/scsi/drivers/sd/${device}/rescan;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ keytool -genkey -storepass "$KS_PASS" -keypass "$KS_PASS" -alias "$ALIAS" -keyal
|
||||||
# Generate CSR
|
# Generate CSR
|
||||||
$LOGGER_CMD "Generating CSR"
|
$LOGGER_CMD "Generating CSR"
|
||||||
[ -f "$CSR_FILE" ] && rm -f "$CSR_FILE"
|
[ -f "$CSR_FILE" ] && rm -f "$CSR_FILE"
|
||||||
addresses=$(ip address | grep inet | awk '{print $2}' | sed 's/\/.*//g' | grep -v '^169.254.' | grep -v '^127.0.0.1' | egrep -v '^::1|^fe80' | grep -v '^::1' | sed 's/^/ip:/g' | tr '\r\n' ',')
|
addresses=$(ip address | grep inet | awk '{print $2}' | sed 's/\/.*//g' | grep -v '^169.254.' | grep -v '^127.0.0.1' | grep -E -v '^::1|^fe80' | grep -v '^::1' | sed 's/^/ip:/g' | tr '\r\n' ',')
|
||||||
$LOGGER_CMD "Found following SAN addresses to add to CSR: ${addresses}"
|
$LOGGER_CMD "Found following SAN addresses to add to CSR: ${addresses}"
|
||||||
keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file "$CSR_FILE" -keystore "$KS_FILE" -ext san="$addresses" 2>&1 | $LOGGER_CMD
|
keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file "$CSR_FILE" -keystore "$KS_FILE" -ext san="$addresses" 2>&1 | $LOGGER_CMD
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ];then
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ find_port_group() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# try to find the physical link to outside, only supports eth and em prefix now
|
# try to find the physical link to outside, only supports eth and em prefix now
|
||||||
trunk_port=`ovs-ofctl show $br | egrep "\((eth|em)[0-9]" | cut -d '(' -f 1|tr -d ' '`
|
trunk_port=`ovs-ofctl show $br | grep -E "\((eth|em)[0-9]" | cut -d '(' -f 1|tr -d ' '`
|
||||||
vm_port=$(find_port $vm_mac)
|
vm_port=$(find_port $vm_mac)
|
||||||
|
|
||||||
# craft the vlan headers. Adding 4096 as in hex, it must be of the form 0x1XXX
|
# craft the vlan headers. Adding 4096 as in hex, it must be of the form 0x1XXX
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# try to find the physical link to outside, only supports eth and em prefix now
|
# try to find the physical link to outside, only supports eth and em prefix now
|
||||||
trunk_port=`ovs-ofctl show $br | egrep "\((eth|em)[0-9]" | cut -d '(' -f 1|tr -d ' '`
|
trunk_port=`ovs-ofctl show $br | grep -E "\((eth|em)[0-9]" | cut -d '(' -f 1|tr -d ' '`
|
||||||
|
|
||||||
if [ "$op" == "add" ]
|
if [ "$op" == "add" ]
|
||||||
then
|
then
|
||||||
|
|
|
||||||
|
|
@ -986,7 +986,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
||||||
double totalcpucap = 0;
|
double totalcpucap = 0;
|
||||||
if (StringUtils.isEmpty(cpucaps)) {
|
if (StringUtils.isEmpty(cpucaps)) {
|
||||||
String totalCpus = Script.runSimpleBashScript("nproc --all| tr '\\n' \" \"");
|
String totalCpus = Script.runSimpleBashScript("nproc --all| tr '\\n' \" \"");
|
||||||
String maxCpuSpeed = Script.runSimpleBashScript("lscpu | egrep 'CPU max MHz' | head -1 | cut -f 2 -d : | tr -d ' '| tr '\\n' \" \"");
|
String maxCpuSpeed = Script.runSimpleBashScript("lscpu | grep -E 'CPU max MHz' | head -1 | cut -f 2 -d : | tr -d ' '| tr '\\n' \" \"");
|
||||||
if (StringUtils.isNotEmpty(totalCpus) && StringUtils.isNotEmpty(maxCpuSpeed)) {
|
if (StringUtils.isNotEmpty(totalCpus) && StringUtils.isNotEmpty(maxCpuSpeed)) {
|
||||||
totalcpucap = Double.parseDouble(totalCpus) * Double.parseDouble(maxCpuSpeed);
|
totalcpucap = Double.parseDouble(totalCpus) * Double.parseDouble(maxCpuSpeed);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ isCifs() {
|
||||||
|
|
||||||
# ping dns server
|
# ping dns server
|
||||||
echo ================================================
|
echo ================================================
|
||||||
DNSSERVER=`egrep '^nameserver' /etc/resolv.conf | awk '{print $2}'| head -1`
|
DNSSERVER=`grep -E '^nameserver' /etc/resolv.conf | awk '{print $2}'| head -1`
|
||||||
echo "First DNS server is " $DNSSERVER
|
echo "First DNS server is " $DNSSERVER
|
||||||
ping -c 2 $DNSSERVER
|
ping -c 2 $DNSSERVER
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ get_interface() {
|
||||||
for i in `seq 1 $(($timeout))`
|
for i in `seq 1 $(($timeout))`
|
||||||
do
|
do
|
||||||
#inf=$(ip route list ${1}/${2} | awk '{print $3}')
|
#inf=$(ip route list ${1}/${2} | awk '{print $3}')
|
||||||
inf=$(ip addr show|egrep '^ *inet'|grep ${1}/${2} |grep brd|awk -- '{ print $NF; }')
|
inf=$(ip addr show|grep -E '^ *inet'|grep ${1}/${2} |grep brd|awk -- '{ print $NF; }')
|
||||||
if [ ! -z $inf ]; then
|
if [ ! -z $inf ]; then
|
||||||
echo $inf
|
echo $inf
|
||||||
break
|
break
|
||||||
|
|
|
||||||
|
|
@ -210,9 +210,9 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
|
||||||
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
|
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
|
||||||
return
|
return
|
||||||
elif redundant_state == "PRIMARY":
|
elif redundant_state == "PRIMARY":
|
||||||
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state DOWN" |wc -l' % publicNics
|
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state DOWN" |wc -l' % publicNics
|
||||||
elif redundant_state == "BACKUP":
|
elif redundant_state == "BACKUP":
|
||||||
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state UP" |wc -l' % publicNics
|
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state UP" |wc -l' % publicNics
|
||||||
result = get_process_status(
|
result = get_process_status(
|
||||||
host.ipaddress,
|
host.ipaddress,
|
||||||
host.port,
|
host.port,
|
||||||
|
|
|
||||||
|
|
@ -210,9 +210,9 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
|
||||||
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
|
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
|
||||||
return
|
return
|
||||||
elif redundant_state == "PRIMARY":
|
elif redundant_state == "PRIMARY":
|
||||||
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state DOWN" |wc -l' % publicNics
|
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state DOWN" |wc -l' % publicNics
|
||||||
elif redundant_state == "BACKUP":
|
elif redundant_state == "BACKUP":
|
||||||
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state UP" |wc -l' % publicNics
|
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state UP" |wc -l' % publicNics
|
||||||
result = get_process_status(
|
result = get_process_status(
|
||||||
host.ipaddress,
|
host.ipaddress,
|
||||||
host.port,
|
host.port,
|
||||||
|
|
|
||||||
|
|
@ -214,9 +214,9 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
|
||||||
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
|
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
|
||||||
return
|
return
|
||||||
elif redundant_state == "PRIMARY":
|
elif redundant_state == "PRIMARY":
|
||||||
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state DOWN" |wc -l' % publicNics
|
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state DOWN" |wc -l' % publicNics
|
||||||
elif redundant_state == "BACKUP":
|
elif redundant_state == "BACKUP":
|
||||||
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state UP" |wc -l' % publicNics
|
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state UP" |wc -l' % publicNics
|
||||||
result = get_process_status(
|
result = get_process_status(
|
||||||
host.ipaddress,
|
host.ipaddress,
|
||||||
host.port,
|
host.port,
|
||||||
|
|
|
||||||
|
|
@ -214,9 +214,9 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
|
||||||
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
|
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
|
||||||
return
|
return
|
||||||
elif redundant_state == "PRIMARY":
|
elif redundant_state == "PRIMARY":
|
||||||
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state DOWN" |wc -l' % publicNics
|
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state DOWN" |wc -l' % publicNics
|
||||||
elif redundant_state == "BACKUP":
|
elif redundant_state == "BACKUP":
|
||||||
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state UP" |wc -l' % publicNics
|
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state UP" |wc -l' % publicNics
|
||||||
result = get_process_status(
|
result = get_process_status(
|
||||||
host.ipaddress,
|
host.ipaddress,
|
||||||
host.port,
|
host.port,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue