diff options
| -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 | ||||
| -rwxr-xr-x | manage.py | 2 | ||||
| -rw-r--r-- | units/graphics/jobs.pxu | 2 |
5 files changed, 37 insertions, 12 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 @@ -5,7 +5,7 @@ from plainbox.provider_manager import N_ setup( name='plainbox-provider-checkbox', namespace='com.canonical.certification', - version="0.65.0rc1", + version="0.65.0rc2", description=N_("Checkbox provider"), gettext_domain='plainbox-provider-checkbox', strict=False, deprecated=False, 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} |
