diff options
author | Jenkins <jenkins@cert-jenkins-master-201506-18558.maas> | 2022-06-23 06:30:29 +0000 |
---|---|---|
committer | Jenkins <jenkins@cert-jenkins-master-201506-18558.maas> | 2022-06-23 06:30:29 +0000 |
commit | 5f1f016df3748646c8770c5fe4be53d8f2ff0bb5 (patch) | |
tree | 6633e58a5799cae81c7e783f17f4026686bdb257 | |
parent | cbdfc4be11b2138753ca0ab09da13e68305c60ff (diff) | |
parent | 0bc1f6761099d405269e19b121e5c3250fce5fe5 (diff) |
Merge branch 'master' into release
-rwxr-xr-x | bin/install-method-check.sh | 39 | ||||
-rwxr-xr-x | bin/network_device_info.py | 3 | ||||
-rwxr-xr-x | bin/touchpad_confidence_bit.py | 3 | ||||
-rw-r--r-- | units/graphics/jobs.pxu | 2 |
4 files changed, 36 insertions, 11 deletions
diff --git a/bin/install-method-check.sh b/bin/install-method-check.sh index 20c0e61..0e86385 100755 --- a/bin/install-method-check.sh +++ b/bin/install-method-check.sh @@ -70,21 +70,46 @@ get_install_datasource() { fi } +# Returns 1 if input takes the form of an IPv4 address, +# 0 otherwise +is_ip_addr() { + local ip=$1 + local stat=1 + if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + OIFS=$IFS + IFS='.' + read -r -a ip_array <<< "$ip" + IFS=$OIFS + [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ + && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] + stat=$? + fi + return $stat +} + # Verify that the $INSTALL_DATASOURCE points to a valid IP address. # Note: Function assumes that $INSTALL_DATASOURCE is already set, as is # done by the get_install_datasource() function. verify_maas_ip() { + MAAS_IP="" if [[ $INSTALL_DATASOURCE_FOUND == 1 ]]; then MAAS_HOSTNAME=$(echo "$INSTALL_DATASOURCE" | cut -d "/" -f 3 | cut -d ":" -f 1) - HOST_OUTPUT=$(host "$MAAS_HOSTNAME" | grep "has address") - status=$? - if [[ $status -eq 0 ]]; then - MAAS_IP=$(echo "$HOST_OUTPUT" | cut -d " " -f 4) - conditional_print "MAAS server's IP address is $MAAS_IP" "maas" - conditional_print "ERROR: MAAS server's IP address is $MAAS_IP" "subiquity" - MAAS_IP_FOUND=1 + is_ip_addr "$MAAS_HOSTNAME" + if [[ $? -ne 1 ]]; then + MAAS_IP=$MAAS_HOSTNAME else + HOST_OUTPUT=$(host "$MAAS_HOSTNAME" | grep "has address") + status=$? + if [[ $status -eq 0 ]]; then + MAAS_IP=$(echo "$HOST_OUTPUT" | cut -d " " -f 4) + fi + fi + if [ -z "$MAAS_IP" ] ; then conditional_print "ERROR: Unable to determine MAAS server's IP address" "maas" + else + MAAS_IP_FOUND=1 + conditional_print "MAAS server's IP address is $MAAS_IP" "maas" + conditional_print "ERROR: MAAS server's IP address is $MAAS_IP" "subiquity" fi fi } diff --git a/bin/network_device_info.py b/bin/network_device_info.py index 10865b9..9d31f75 100755 --- a/bin/network_device_info.py +++ b/bin/network_device_info.py @@ -343,7 +343,8 @@ class UdevDevices(): def _collect_devices(self): cmd = ['udevadm', 'info', '--export-db'] try: - output = check_output(cmd).decode(sys.stdout.encoding) + output = check_output(cmd).decode(sys.stdout.encoding, + errors='ignore') except CalledProcessError as err: sys.stderr.write(err) return diff --git a/bin/touchpad_confidence_bit.py b/bin/touchpad_confidence_bit.py index ff47e6d..127dca4 100755 --- a/bin/touchpad_confidence_bit.py +++ b/bin/touchpad_confidence_bit.py @@ -14,7 +14,8 @@ class TouchpadDevices: def _collect_devices(self): cmd = ['udevadm', 'info', '--export-db'] try: - output = check_output(cmd).decode(sys.stdout.encoding) + output = check_output(cmd).decode(sys.stdout.encoding, + errors='ignore') except CalledProcessError as err: sys.stderr.write(err) return diff --git a/units/graphics/jobs.pxu b/units/graphics/jobs.pxu index 8206f1a..d9814c7 100644 --- a/units/graphics/jobs.pxu +++ b/units/graphics/jobs.pxu @@ -43,7 +43,6 @@ template-resource: graphics_card plugin: manual category_id: com.canonical.plainbox::graphics id: graphics/{index}_resolution-change_{product_slug} -depends: graphics/xorg-version _summary: Test changing resolution for {vendor} {product} _description: PURPOSE: @@ -236,7 +235,6 @@ template-filter: graphics_card.prime_gpu_offload == 'Off' plugin: user-interact-verify category_id: com.canonical.plainbox::graphics id: graphics/{index}_rotation_{product_slug} -depends: graphics/xorg-version command: # shellcheck disable=SC1091 source graphics_env.sh {driver} {index} |