#!/bin/sh

set -e

SRU_SERIES="bionic eoan focal xenial"

# local values
LP_USER=${LP_USER:-"lamoura"}
PRESERVE_INSTANCE=false

# Provide USE_DEV_PPA=1 if we are SRU queue is still unapproved
# This will use our ppa:cloud-init-dev/proposed
if [ "${USE_DEV_PPA:-1}" -eq "0" ]; then
    PROPOSED_SCRIPT=setup_proposed.sh
else
    PROPOSED_SCRIPT=setup_dev_proposed.sh
fi

while [ $# -ne 0 ]; do
	case "$1" in
		# any flag pass through.
		--preserve-instance) PRESERVE_INSTANCE=true;;
		--) shift; break;;
	esac
	shift;
done


# Manual EC2 upgrade and clean install validation
cat > sethostname.yaml <<EOF
## template: jinja
#cloud-config
ssh_import_id: [$LP_USER]
hostname: SRU-worked-{{v1.cloud_name}}
EOF

cat > setup_proposed.sh <<EOF
#/bin/bash
mirror=http://archive.ubuntu.com/ubuntu
echo deb \$mirror \$(lsb_release -sc)-proposed main | tee /etc/apt/sources.list.d/proposed.list
apt-get update -q;
apt-get install -qy cloud-init;
EOF

cat > setup_dev_proposed.sh <<EOF
#/bin/bash
add-apt-repository ppa:cloud-init-dev/proposed -y
apt-get update -q;
apt-get install -qy cloud-init;
EOF

# set -x outputs each commant to standard error, so an easy way to keen an eye
# what's going on while saving a clean log file (stdout only) is using tee(1).
set -x

sshopts="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR"

run_describe_command() {
    dnsname=$1
    query=$2
    aws ec2 describe-instances --filter "Name=dns-name,Values=${dnsname}" --query $query | jq -r .[]
}

get_ec2_instance_id() {
    dns_name=$1
    dns_name="${dns_name#"ubuntu@"}"
    query='Reservations[].Instances[].InstanceId'
    run_describe_command $dns_name $query
}

terminate_instance() {
    ec2_inst=$1
    if [ "$PRESERVE_INSTANCE" = false ]; then
        echo "deleting instance"
        ec2_inst_id=`get_ec2_instance_id ${ec2_inst}`
        aws ec2 terminate-instances --instance-ids $ec2_inst_id
    else
        echo "Keeping instance active"
    fi
}

get_subnet_id() {
    inst_name=$1
    dns_name="${inst_name#"ubuntu@"}"
    query='Reservations[].Instances[].SubnetId'
    run_describe_command $dns_name $query
}

create_network_interface() {
    subnet_id=$1
    aws ec2 create-network-interface --subnet-id $subnet_id
}

get_network_interface_id() {
    network_interface_json=$*
    echo $network_interface_json | jq -r .NetworkInterface.NetworkInterfaceId
}

delete_network_interface() {
    network_interface_id=$1
    aws ec2 delete-network-interface --network-interface-id $network_interface_id
}

attach_network_interface() {
    instance_id=$1
    network_interface_id=$2
    device_index=$3

    aws ec2 attach-network-interface --device-index $device_index --instance-id $instance_id --network-interface-id $network_interface_id | jq -r .AttachmentId
}

detach_network_interface() {
    attachment_id=$1
    aws ec2 detach-network-interface --attachment-id $attachment_id
}

setup_network_interface() {
    subnet_id=$1
    network_interface_json=$(create_network_interface $subnet_id)
    get_network_interface_id $network_interface_json
}

teardown_network_interface() {
    attachment_id=$1
    network_interface_id=$2

    detach_network_interface $attachment_id
    sleep 30
    delete_network_interface $network_interface_id
}

perform_eni_route_verification() {
    ec2_inst=$1
    net_file=$2
    eni_numbers="0 1 2"

    for NUMBER in $eni_numbers; do
        eth_name="eth${NUMBER}"
        metric_expected=$(expr `expr $NUMBER + 1` \* 100)
        actual_metric=$(ssh $sshopts $ec2_inst -- cat $net_file | grep -A3 -m1 $eth_name | awk 'NF' | tail -n1 | awk '{print $2}')

        if [ "$metric_expected" = "$actual_metric" ]; then
            echo "route metric is correct"
        else
            echo "Incorrect value for route metric"
            exit 1
        fi
    done
}

count_occurrences_in_file() {
    search_file=$1
    search_pattern=$2
    ssh $sshopts $ec2_inst -- cat $search_file | grep $search_pattern | wc -l
}

perform_only_eth0_route_verification() {
    ec2_inst=$1
    net_file=$2

    metric_count_expected=0
    metric_count_actual=$(count_occurrences_in_file $net_file "metric")

    if [ "$metric_count_expected" = "$metric_count_actual" ]; then
        echo "No metrics as expected"
    else
        echo "Error: metric defined in config"
        exit 1
    fi

    metric_count_expected=2
    metric_count_actual=$(count_occurrences_in_file $net_file "eth0")

    if [ "$metric_count_expected" = "$metric_count_actual" ]; then
        echo "eth0 interface rendered"
    else
        echo "Error: eth0 interface not defined in config"
        exit 1
    fi

    metric_count_expected=0
    metric_count_actual=$(count_occurrences_in_file $net_file "eth[12]")

    if [ "$metric_count_expected" = "$metric_count_actual" ]; then
        echo "No eth1 or eth2 interfaces rendered"
    else
        echo "Error: eth1/eth2 interfaces are rendered"
        exit 1
    fi

}

perform_nic_ordering_test() {
    ec2_inst=$1
    series=$2

    instance_id=$(get_ec2_instance_id $ec2_inst)
    subnet_id=$(get_subnet_id $ec2_inst)

    echo "Creating two nic to test feature..."
    network_interface_id_1=$(setup_network_interface $subnet_id)
    network_interface_id_2=$(setup_network_interface $subnet_id)

    echo "Attaching network interfaces to instance..."
    attachment_id_1=$(attach_network_interface $instance_id $network_interface_id_1 1)
    attachment_id_2=$(attach_network_interface $instance_id $network_interface_id_2 2)
    sleep 60

    ssh $sshopts $ec2_inst -- sudo cloud-init init
    ssh $sshopts $ec2_inst -- ! grep Trace "/var/log/cloud-init*"
    ssh $sshopts $ec2_inst -- sudo cloud-init clean --logs --reboot || true
    sleep 90
    ssh $sshopts $ec2_inst -- cloud-init status --wait --long; date --utc +%s.%N

    net_file=/etc/netplan/50-cloud-init.yaml

    if [ "$series" = "focal" ]; then
        perform_eni_route_verification $ec2_inst $net_file
    elif [ "$series" = "xenial" ]; then
        net_file=/etc/network/interfaces.d/50-cloud-init.cfg
        perform_only_eth0_route_verification $ec2_inst $net_file
    else
        perform_only_eth0_route_verification $ec2_inst $net_file
    fi

    teardown_network_interface $attachment_id_1 $network_interface_id_1
    teardown_network_interface $attachment_id_2 $network_interface_id_2
}

perform_imds_hidden_token_verification() {
    ec2_inst=$1
    search_file=/var/log/cloud-init.log
    search_pattern="'X-aws-ec2-metadata-token'"
    num_token_key=$(count_occurrences_in_file $search_file $search_pattern)

    search_pattern="'X-aws-ec2-metadata-token': 'REDACTED'"
    num_token_key_redacted=$(count_occurrences_in_file $search_file $search_pattern)

    if [ "$num_token_key" = "$num_token_key_redacted" ]; then
        echo "X-aws-ec2-metadata-token are correctly appearing as redacted in logs"
    else
        echo "X-aws-ec2-metadata-token are fully appearing raw in log"
        exit 2
    fi

    search_pattern="'X-aws-ec2-metadata-token-ttl-seconds'"
    num_token_key=$(count_occurrences_in_file $search_file $search_pattern)

    search_pattern="'X-aws-ec2-metadata-token-ttl-seconds': 'REDACTED'"
    num_token_key_redacted=$(count_occurrences_in_file $search_file $search_pattern)

    if [ "$num_token_key" = "$num_token_key_redacted" ]; then
        echo "X-aws-ec2-metadata-token-ttl-seconds are correctly appearing as redacted in logs"
    else
        echo "X-aws-ec2-metadata-token-ttl-seconds are fully appearing raw in log"
        exit 2
    fi
}


for series in $SRU_SERIES; do
    echo "### BEGIN $series"
    EC2_INST=`launch-ec2 --series $series -u sethostname.yaml -t t2.small | awk '/Found/{print $5}'`
    [ -n "$EC2_INST" ] || { echo "Failed to launch ec2 instance!"; exit 1; }
    sleep 60

    trap "terminate_instance ${EC2_INST}" ERR
    ssh $sshopts $EC2_INST -- cloud-init status --wait --long
    ssh $sshopts $EC2_INST -- cat /run/cloud-init/result.json
    ssh $sshopts $EC2_INST -- ! grep Trace "/var/log/cloud-init.*"
    echo "Expect IMDSv2 token headers are being used on all metadata gets. Expect 0 line count"
    ssh $sshopts $EC2_INST --  '[[ 0 = `grep headers /var/log/cloud-init.log  | grep -c -v X-aws` ]] || exit 1'
    ssh $sshopts $EC2_INST -- sudo systemd-analyze
    ssh $sshopts $EC2_INST -- sudo systemd-analyze blame
    ssh $sshopts $EC2_INST -- sudo cloud-init analyze show
    ssh $sshopts $EC2_INST -- ! sudo grep Trace "/var/log/cloud-init*"
    scp $sshopts $PROPOSED_SCRIPT $EC2_INST:
    ssh $sshopts $EC2_INST sudo bash $PROPOSED_SCRIPT 2>&1 | egrep 'cloud-init'
    ssh $sshopts $EC2_INST sudo hostname something-else
    ssh $sshopts $EC2_INST -- sudo cloud-init init
    ssh $sshopts $EC2_INST -- ! grep Trace "/var/log/cloud-init*"
    ssh $sshopts $EC2_INST -- sudo cloud-init clean --logs --reboot || true
    sleep 60
    date --utc +%s.%N
    ssh $sshopts $EC2_INST -- cloud-init status --wait --long; date --utc +%s.%N
    ssh $sshopts $EC2_INST -- hostname
    ssh $sshopts $EC2_INST -- ! grep Trace "/var/log/cloud-init*"
    ssh $sshopts $EC2_INST -- sudo systemd-analyze
    ssh $sshopts $EC2_INST -- sudo cloud-init analyze show
    if [ "$series" = "xenial" ]; then
       echo "--- Expect warning on xenial for jinja because deb DOES NOT have jinja dep."
    else
       echo "--- Expect success on bionic for jinja because deb DOES have jinja dep."
    fi
    ssh $sshopts $EC2_INST "cloud-init query --format 'cloud-region: {{cloud_name}}-{{region}}'"
    
    echo 'Get cloud-id'
    ssh $sshopts $EC2_INST cloud-id

    echo 'Per LP:1863943 we should hide IMDSv2 tokens on the log'
    perform_imds_hidden_token_verification $EC2_INST

    echo 'Per LP:1876312 should route based on device-number not on mac address'
    echo 'Per LP:1866930 should configure other network interfaces from imds data'
    echo 'However LP:1866930 does not apply to Bionic, Eoan and Xenial'
    perform_nic_ordering_test $EC2_INST $series

    echo 'Validating whether metadata is being updated per boot LP:1819913'
    ssh $sshopts $EC2_INST "grep 'Update datasource' /var/log/cloud-init.log"
    ssh $sshopts $EC2_INST sudo reboot || true
    sleep 60
    echo 'After reboot'
    ssh $sshopts $EC2_INST "grep 'Update datasource' /var/log/cloud-init.log"
    terminate_instance $EC2_INST
    echo "### END $series"
done

# Verification log

+ sshopts='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR'
+ for series in $SRU_SERIES
+ echo '### BEGIN bionic'
### BEGIN bionic
++ launch-ec2 --series bionic -u sethostname.yaml -t t2.small
++ awk '/Found/{print $5}'
+ EC2_INST=ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
+ '[' -n ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com ']'
+ sleep 60
+ trap 'terminate_instance ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com' ERR
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 14:58:54 +0000
detail:
DataSourceEc2Local
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- cat /run/cloud-init/result.json
{
 "v1": {
  "datasource": "DataSourceEc2Local",
  "errors": []
 }
}
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init.*'
+ echo 'Expect IMDSv2 token headers are being used on all metadata gets. Expect 0 line count'
Expect IMDSv2 token headers are being used on all metadata gets. Expect 0 line count
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- '[[ 0 = `grep headers /var/log/cloud-init.log  | grep -c -v X-aws` ]] || exit 1'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- sudo systemd-analyze
Startup finished in 4.859s (kernel) + 24.348s (userspace) = 29.207s
graphical.target reached after 23.546s in userspace
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- sudo systemd-analyze blame
         11.742s snapd.seeded.service
          3.133s console-setup.service
          1.952s cloud-config.service
          1.936s keyboard-setup.service
          1.849s apparmor.service
          1.800s cloud-init-local.service
          1.800s dev-xvda1.device
          1.654s pollinate.service
          1.337s systemd-networkd-wait-online.service
          1.180s cloud-init.service
          1.075s snapd.service
           801ms cloud-final.service
           746ms networkd-dispatcher.service
           482ms accounts-daemon.service
           473ms systemd-udev-trigger.service
           399ms lxd-containers.service
           342ms apport.service
           314ms systemd-journald.service
           290ms systemd-modules-load.service
           280ms systemd-logind.service
           272ms grub-common.service
           264ms rsyslog.service
           188ms lvm2-monitor.service
           183ms polkit.service
           161ms snapd.socket
           145ms hibinit-agent.service
           135ms ebtables.service
           131ms sys-kernel-debug.mount
           119ms systemd-timesyncd.service
           117ms kmod-static-nodes.service
           114ms systemd-remount-fs.service
            89ms systemd-udevd.service
            87ms ufw.service
            81ms systemd-journal-flush.service
            75ms systemd-machine-id-commit.service
            74ms lxd.socket
            74ms plymouth-read-write.service
            72ms dev-mqueue.mount
            68ms systemd-tmpfiles-setup.service
            65ms dev-hugepages.mount
            63ms systemd-networkd.service
            60ms systemd-resolved.service
            49ms plymouth-quit.service
            48ms systemd-user-sessions.service
            45ms systemd-sysctl.service
            44ms sys-fs-fuse-connections.mount
            42ms sys-kernel-config.mount
            42ms systemd-update-utmp-runlevel.service
            42ms blk-availability.service
            38ms systemd-random-seed.service
            38ms systemd-tmpfiles-setup-dev.service
            37ms ssh.service
            31ms user@1000.service
            29ms systemd-update-utmp.service
            28ms dev-loop1.device
            28ms snap-amazon\x2dssm\x2dagent-1566.mount
            26ms snap-core-9289.mount
            25ms setvtrgb.service
            25ms plymouth-quit-wait.service
            14ms dev-loop0.device
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- sudo cloud-init analyze show
-- Boot Record 01 --
The total time elapsed since completing an event is printed after the "@" character.
The time the event takes is printed after the "+" character.

Starting stage: init-local
|`->no cache found @00.01200s +00.00000s
|`->found local data from DataSourceEc2Local @00.04800s +00.38300s
Finished stage: (init-local) 00.72500 seconds

Starting stage: init-network
|`->restored from cache with run check: DataSourceEc2Local @02.67600s +00.01500s
|`->setting up datasource @02.75100s +00.00100s
|`->reading and applying user-data @02.75900s +00.00800s
|`->reading and applying vendor-data @02.76700s +00.00000s
|`->activating datasource @02.80200s +00.00100s
|`->config-migrator ran successfully @02.84000s +00.00100s
|`->config-seed_random ran successfully @02.84100s +00.00100s
|`->config-bootcmd ran successfully @02.84200s +00.00000s
|`->config-write-files ran successfully @02.84200s +00.00100s
|`->config-growpart ran successfully @02.84300s +00.13200s
|`->config-resizefs ran successfully @02.97600s +00.05600s
|`->config-disk_setup ran successfully @03.03300s +00.00400s
|`->config-mounts ran successfully @03.04100s +00.00100s
|`->config-set_hostname ran successfully @03.04300s +00.00900s
|`->config-update_hostname ran successfully @03.05300s +00.00700s
|`->config-update_etc_hosts ran successfully @03.06000s +00.00000s
|`->config-ca-certs ran successfully @03.06100s +00.00000s
|`->config-rsyslog ran successfully @03.06200s +00.00000s
|`->config-users-groups ran successfully @03.06200s +00.07900s
|`->config-ssh ran successfully @03.14100s +00.14300s
Finished stage: (init-network) 00.62200 seconds

Starting stage: modules-config
|`->config-emit_upstart ran successfully @16.66700s +00.00000s
|`->config-snap ran successfully @16.66700s +00.00100s
|`->config-ssh-import-id ran successfully @16.66800s +00.77500s
|`->config-locale ran successfully @17.44300s +00.00200s
|`->config-set-passwords ran successfully @17.44500s +00.00100s
|`->config-grub-dpkg ran successfully @17.44600s +00.46500s
|`->config-apt-pipelining ran successfully @17.91200s +00.00100s
|`->config-apt-configure ran successfully @17.91300s +00.13100s
|`->config-ubuntu-advantage ran successfully @18.04400s +00.00100s
|`->config-ntp ran successfully @18.04500s +00.00100s
|`->config-timezone ran successfully @18.04600s +00.00100s
|`->config-disable-ec2-metadata ran successfully @18.04700s +00.00000s
|`->config-runcmd ran successfully @18.04700s +00.00100s
|`->config-byobu ran successfully @18.04800s +00.00100s
Finished stage: (modules-config) 01.40100 seconds

Starting stage: modules-final
|`->config-package-update-upgrade-install ran successfully @18.85500s +00.00100s
|`->config-fan ran successfully @18.85600s +00.00100s
|`->config-landscape ran successfully @18.85700s +00.00100s
|`->config-lxd ran successfully @18.85800s +00.00100s
|`->config-ubuntu-drivers ran successfully @18.85900s +00.00100s
|`->config-puppet ran successfully @18.86000s +00.00000s
|`->config-chef ran successfully @18.86100s +00.00000s
|`->config-mcollective ran successfully @18.86200s +00.00000s
|`->config-salt-minion ran successfully @18.86200s +00.00100s
|`->config-rightscale_userdata ran successfully @18.86300s +00.00100s
|`->config-scripts-vendor ran successfully @18.86400s +00.00100s
|`->config-scripts-per-once ran successfully @18.86500s +00.00100s
|`->config-scripts-per-boot ran successfully @18.86600s +00.00000s
|`->config-scripts-per-instance ran successfully @18.86600s +00.00100s
|`->config-scripts-user ran successfully @18.86700s +00.00100s
|`->config-ssh-authkey-fingerprints ran successfully @18.86800s +00.04800s
|`->config-keys-to-console ran successfully @18.91600s +00.09200s
|`->config-phone-home ran successfully @19.00900s +00.00100s
|`->config-final-message ran successfully @19.01000s +00.00500s
|`->config-power-state-change ran successfully @19.01500s +00.00100s
Finished stage: (modules-final) 00.18300 seconds

Total Time: 2.93100 seconds

1 boot records analyzed
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- '!' sudo grep Trace '/var/log/cloud-init*'
+ scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR setup_dev_proposed.sh ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com:
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com sudo bash setup_dev_proposed.sh
+ egrep cloud-init
Get:6 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu bionic InRelease [15.9 kB]
Get:25 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu bionic/main amd64 Packages [656 B]
Get:26 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu bionic/main Translation-en [248 B]
Hit:5 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu bionic InRelease
  cloud-init
Get:1 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu bionic/main amd64 cloud-init all 20.2-45-g5f7825e2-0ubuntu1~18.04.1 [468 kB]
Preparing to unpack .../cloud-init_20.2-45-g5f7825e2-0ubuntu1~18.04.1_all.deb ...
Unpacking cloud-init (20.2-45-g5f7825e2-0ubuntu1~18.04.1) over (19.4-33-gbb4131a2-0ubuntu1~18.04.1) ...
Setting up cloud-init (20.2-45-g5f7825e2-0ubuntu1~18.04.1) ...
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com sudo hostname something-else
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- sudo cloud-init init
Cloud-init v. 20.2-45-g5f7825e2-0ubuntu1~18.04.1 running 'init' at Thu, 11 Jun 2020 15:00:40 +0000. Up 135.13 seconds.
ci-info: ++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: | Device |  Up  |           Address           |      Mask     | Scope  |     Hw-Address    |
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: |  eth0  | True |         10.41.41.250        | 255.255.255.0 | global | 06:2d:7e:8f:a5:20 |
ci-info: |  eth0  | True | fe80::42d:7eff:fe8f:a520/64 |       .       |  link  | 06:2d:7e:8f:a5:20 |
ci-info: |   lo   | True |          127.0.0.1          |   255.0.0.0   |  host  |         .         |
ci-info: |   lo   | True |           ::1/128           |       .       |  host  |         .         |
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: +++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++++
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: | Route | Destination |  Gateway   |     Genmask     | Interface | Flags |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: |   0   |   0.0.0.0   | 10.41.41.1 |     0.0.0.0     |    eth0   |   UG  |
ci-info: |   1   |  10.41.41.0 |  0.0.0.0   |  255.255.255.0  |    eth0   |   U   |
ci-info: |   2   |  10.41.41.1 |  0.0.0.0   | 255.255.255.255 |    eth0   |   UH  |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: | Route | Destination | Gateway | Interface | Flags |
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: |   1   |  fe80::/64  |    ::   |    eth0   |   U   |
ci-info: |   3   |    local    |    ::   |    eth0   |   U   |
ci-info: |   4   |   ff00::/8  |    ::   |    eth0   |   U   |
ci-info: +-------+-------------+---------+-----------+-------+
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- sudo cloud-init clean --logs --reboot
Connection to ec2-3-21-230-147.us-east-2.compute.amazonaws.com closed by remote host.
+ true
+ sleep 60
+ date --utc +%s.%N
1591887709.163399498
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 15:01:43 +0000
detail:
DataSourceEc2Local
+ date --utc +%s.%N
1591887713.779884107
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- hostname
SRU-worked-aws
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- sudo systemd-analyze
Startup finished in 4.710s (kernel) + 11.773s (userspace) = 16.484s
graphical.target reached after 10.790s in userspace
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- sudo cloud-init analyze show
-- Boot Record 01 --
The total time elapsed since completing an event is printed after the "@" character.
The time the event takes is printed after the "+" character.

Starting stage: init-local
|`->no cache found @00.01000s +00.00000s
|`->found local data from DataSourceEc2Local @00.02100s +00.94400s
Finished stage: (init-local) 01.15900 seconds

Starting stage: init-network
|`->restored from cache with run check: DataSourceEc2Local @02.84200s +00.00300s
|`->setting up datasource @02.90600s +00.00100s
|`->reading and applying user-data @02.91400s +00.00800s
|`->reading and applying vendor-data @02.92200s +00.00000s
|`->activating datasource @02.95800s +00.00200s
|`->config-migrator ran successfully @02.99800s +00.00100s
|`->config-seed_random ran successfully @02.99900s +00.00100s
|`->config-bootcmd ran successfully @03.00000s +00.00000s
|`->config-write-files ran successfully @03.00100s +00.00800s
|`->config-growpart ran successfully @03.01000s +00.13000s
|`->config-resizefs ran successfully @03.14100s +00.06400s
|`->config-disk_setup ran successfully @03.20500s +00.00100s
|`->config-mounts ran successfully @03.20700s +00.00100s
|`->config-set_hostname ran successfully @03.20800s +00.01200s
|`->config-update_hostname ran successfully @03.22000s +00.00200s
|`->config-update_etc_hosts ran successfully @03.22200s +00.00100s
|`->config-ca-certs ran successfully @03.22300s +00.00100s
|`->config-rsyslog ran successfully @03.22400s +00.00000s
|`->config-users-groups ran successfully @03.22500s +00.01900s
|`->config-ssh ran successfully @03.24400s +00.20500s
Finished stage: (init-network) 00.62300 seconds

Starting stage: modules-config
|`->config-emit_upstart ran successfully @06.83100s +00.00100s
|`->config-snap ran successfully @06.83200s +00.00100s
|`->config-ssh-import-id ran successfully @06.83300s +00.83900s
|`->config-locale ran successfully @07.67200s +00.01500s
|`->config-set-passwords ran successfully @07.68700s +00.00100s
|`->config-grub-dpkg ran successfully @07.68800s +00.22400s
|`->config-apt-pipelining ran successfully @07.91300s +00.00100s
|`->config-apt-configure ran successfully @07.91400s +00.12000s
|`->config-ubuntu-advantage ran successfully @08.03400s +00.00100s
|`->config-ntp ran successfully @08.03500s +00.00100s
|`->config-timezone ran successfully @08.03600s +00.00100s
|`->config-disable-ec2-metadata ran successfully @08.03700s +00.00400s
|`->config-runcmd ran successfully @08.04200s +00.00000s
|`->config-byobu ran successfully @08.04200s +00.00100s
Finished stage: (modules-config) 01.23200 seconds

Starting stage: modules-final
|`->config-package-update-upgrade-install ran successfully @09.05900s +00.00100s
|`->config-fan ran successfully @09.06000s +00.00100s
|`->config-landscape ran successfully @09.06100s +00.00100s
|`->config-lxd ran successfully @09.06200s +00.00000s
|`->config-ubuntu-drivers ran successfully @09.06300s +00.00000s
|`->config-puppet ran successfully @09.06400s +00.00000s
|`->config-chef ran successfully @09.06400s +00.00100s
|`->config-mcollective ran successfully @09.06500s +00.00100s
|`->config-salt-minion ran successfully @09.06600s +00.00100s
|`->config-rightscale_userdata ran successfully @09.06700s +00.00100s
|`->config-scripts-vendor ran successfully @09.06800s +00.00100s
|`->config-scripts-per-once ran successfully @09.06900s +00.00000s
|`->config-scripts-per-boot ran successfully @09.07000s +00.00000s
|`->config-scripts-per-instance ran successfully @09.07000s +00.00100s
|`->config-scripts-user ran successfully @09.07100s +00.00100s
|`->config-ssh-authkey-fingerprints ran successfully @09.07200s +00.05200s
|`->config-keys-to-console ran successfully @09.12400s +00.07200s
|`->config-phone-home ran successfully @09.19700s +00.00100s
|`->config-final-message ran successfully @09.19800s +00.00500s
|`->config-power-state-change ran successfully @09.20300s +00.00100s
Finished stage: (modules-final) 00.17200 seconds

Total Time: 3.18600 seconds

1 boot records analyzed
+ '[' bionic = xenial ']'
+ echo '--- Expect success on bionic for jinja because deb DOES have jinja dep.'
--- Expect success on bionic for jinja because deb DOES have jinja dep.
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com 'cloud-init query --format '\''cloud-region: {{cloud_name}}-{{region}}'\'''
cloud-region: aws-us-east-2
+ echo 'Get cloud-id'
Get cloud-id
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com cloud-id
aws
+ echo 'Per LP:1863943 we should hide IMDSv2 tokens on the log'
Per LP:1863943 we should hide IMDSv2 tokens on the log
+ perform_imds_hidden_token_verification ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
+ ec2_inst=ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
+ search_file=/var/log/cloud-init.log
+ search_pattern=''\''X-aws-ec2-metadata-token'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token'\'''
++ grep ''\''X-aws-ec2-metadata-token'\'''
++ wc -l
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
+ num_token_key=67
+ search_pattern=''\''X-aws-ec2-metadata-token'\'': '\''REDACTED'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token'\'':' ''\''REDACTED'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token'\'':'
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token'\'':'
++ wc -l
+ num_token_key_redacted=67
+ '[' 67 = 67 ']'
+ echo 'X-aws-ec2-metadata-token are correctly appearing as redacted in logs'
X-aws-ec2-metadata-token are correctly appearing as redacted in logs
+ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ wc -l
+ num_token_key=1
+ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'': '\''REDACTED'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token-ttl-seconds'\'':' ''\''REDACTED'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'':'
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token-ttl-seconds'\'':'
++ wc -l
+ num_token_key_redacted=1
+ '[' 1 = 1 ']'
+ echo 'X-aws-ec2-metadata-token-ttl-seconds are correctly appearing as redacted in logs'
X-aws-ec2-metadata-token-ttl-seconds are correctly appearing as redacted in logs
+ echo 'Per LP:1876312 should route based on device-number not on mac address'
Per LP:1876312 should route based on device-number not on mac address
+ echo 'Per LP:1866930 should configure other network interfaces from imds data'
Per LP:1866930 should configure other network interfaces from imds data
+ echo 'However LP:1866930 does not apply to Bionic, Eoan and Xenial'
However LP:1866930 does not apply to Bionic, Eoan and Xenial
+ perform_nic_ordering_test ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com bionic
+ ec2_inst=ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
+ series=bionic
++ get_ec2_instance_id ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ dns_name=ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ run_describe_command ec2-3-21-230-147.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].InstanceId'
++ dnsname=ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-21-230-147.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].InstanceId'
++ jq -r '.[]'
+ instance_id=i-023249c9384517e31
++ get_subnet_id ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ inst_name=ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].SubnetId'
++ run_describe_command ec2-3-21-230-147.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].SubnetId'
++ dnsname=ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].SubnetId'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-21-230-147.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].SubnetId'
++ jq -r '.[]'
+ subnet_id=subnet-0afec7d3c136a3ccb
+ echo 'Creating two nic to test feature...'
Creating two nic to test feature...
++ setup_network_interface subnet-0afec7d3c136a3ccb
++ subnet_id=subnet-0afec7d3c136a3ccb
+++ create_network_interface subnet-0afec7d3c136a3ccb
+++ subnet_id=subnet-0afec7d3c136a3ccb
+++ aws ec2 create-network-interface --subnet-id subnet-0afec7d3c136a3ccb
++ network_interface_json='{
    "NetworkInterface": {
        "AvailabilityZone": "us-east-2b",
        "Description": "",
        "Groups": [
            {
                "GroupName": "default",
                "GroupId": "sg-0c3f58efd82634f04"
            }
        ],
        "InterfaceType": "interface",
        "Ipv6Addresses": [],
        "MacAddress": "06:c1:55:ae:28:de",
        "NetworkInterfaceId": "eni-08a3fb867f0b2df6e",
        "OwnerId": "329688318733",
        "PrivateDnsName": "ip-10-41-41-105.us-east-2.compute.internal",
        "PrivateIpAddress": "10.41.41.105",
        "PrivateIpAddresses": [
            {
                "Primary": true,
                "PrivateDnsName": "ip-10-41-41-105.us-east-2.compute.internal",
                "PrivateIpAddress": "10.41.41.105"
            }
        ],
        "RequesterManaged": false,
        "SourceDestCheck": true,
        "Status": "pending",
        "SubnetId": "subnet-0afec7d3c136a3ccb",
        "TagSet": [],
        "VpcId": "vpc-019733e0f085e012a"
    }
}'
++ get_network_interface_id '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:c1:55:ae:28:de",' '"NetworkInterfaceId":' '"eni-08a3fb867f0b2df6e",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-105.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.105",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-105.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.105"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
++ network_interface_json='{ "NetworkInterface": { "AvailabilityZone": "us-east-2b", "Description": "", "Groups": [ { "GroupName": "default", "GroupId": "sg-0c3f58efd82634f04" } ], "InterfaceType": "interface", "Ipv6Addresses": [], "MacAddress": "06:c1:55:ae:28:de", "NetworkInterfaceId": "eni-08a3fb867f0b2df6e", "OwnerId": "329688318733", "PrivateDnsName": "ip-10-41-41-105.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.105", "PrivateIpAddresses": [ { "Primary": true, "PrivateDnsName": "ip-10-41-41-105.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.105" } ], "RequesterManaged": false, "SourceDestCheck": true, "Status": "pending", "SubnetId": "subnet-0afec7d3c136a3ccb", "TagSet": [], "VpcId": "vpc-019733e0f085e012a" } }'
++ jq -r .NetworkInterface.NetworkInterfaceId
++ echo '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:c1:55:ae:28:de",' '"NetworkInterfaceId":' '"eni-08a3fb867f0b2df6e",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-105.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.105",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-105.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.105"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
+ network_interface_id_1=eni-08a3fb867f0b2df6e
++ setup_network_interface subnet-0afec7d3c136a3ccb
++ subnet_id=subnet-0afec7d3c136a3ccb
+++ create_network_interface subnet-0afec7d3c136a3ccb
+++ subnet_id=subnet-0afec7d3c136a3ccb
+++ aws ec2 create-network-interface --subnet-id subnet-0afec7d3c136a3ccb
++ network_interface_json='{
    "NetworkInterface": {
        "AvailabilityZone": "us-east-2b",
        "Description": "",
        "Groups": [
            {
                "GroupName": "default",
                "GroupId": "sg-0c3f58efd82634f04"
            }
        ],
        "InterfaceType": "interface",
        "Ipv6Addresses": [],
        "MacAddress": "06:d3:de:61:78:e6",
        "NetworkInterfaceId": "eni-0fdc765efad463bbe",
        "OwnerId": "329688318733",
        "PrivateDnsName": "ip-10-41-41-74.us-east-2.compute.internal",
        "PrivateIpAddress": "10.41.41.74",
        "PrivateIpAddresses": [
            {
                "Primary": true,
                "PrivateDnsName": "ip-10-41-41-74.us-east-2.compute.internal",
                "PrivateIpAddress": "10.41.41.74"
            }
        ],
        "RequesterManaged": false,
        "SourceDestCheck": true,
        "Status": "pending",
        "SubnetId": "subnet-0afec7d3c136a3ccb",
        "TagSet": [],
        "VpcId": "vpc-019733e0f085e012a"
    }
}'
++ get_network_interface_id '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:d3:de:61:78:e6",' '"NetworkInterfaceId":' '"eni-0fdc765efad463bbe",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-74.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.74",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-74.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.74"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
++ network_interface_json='{ "NetworkInterface": { "AvailabilityZone": "us-east-2b", "Description": "", "Groups": [ { "GroupName": "default", "GroupId": "sg-0c3f58efd82634f04" } ], "InterfaceType": "interface", "Ipv6Addresses": [], "MacAddress": "06:d3:de:61:78:e6", "NetworkInterfaceId": "eni-0fdc765efad463bbe", "OwnerId": "329688318733", "PrivateDnsName": "ip-10-41-41-74.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.74", "PrivateIpAddresses": [ { "Primary": true, "PrivateDnsName": "ip-10-41-41-74.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.74" } ], "RequesterManaged": false, "SourceDestCheck": true, "Status": "pending", "SubnetId": "subnet-0afec7d3c136a3ccb", "TagSet": [], "VpcId": "vpc-019733e0f085e012a" } }'
++ jq -r .NetworkInterface.NetworkInterfaceId
++ echo '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:d3:de:61:78:e6",' '"NetworkInterfaceId":' '"eni-0fdc765efad463bbe",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-74.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.74",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-74.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.74"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
+ network_interface_id_2=eni-0fdc765efad463bbe
+ echo 'Attaching network interfaces to instance...'
Attaching network interfaces to instance...
++ attach_network_interface i-023249c9384517e31 eni-08a3fb867f0b2df6e 1
++ instance_id=i-023249c9384517e31
++ network_interface_id=eni-08a3fb867f0b2df6e
++ device_index=1
++ aws ec2 attach-network-interface --device-index 1 --instance-id i-023249c9384517e31 --network-interface-id eni-08a3fb867f0b2df6e
++ jq -r .AttachmentId
+ attachment_id_1=eni-attach-09c4db222f14f7843
++ attach_network_interface i-023249c9384517e31 eni-0fdc765efad463bbe 2
++ instance_id=i-023249c9384517e31
++ network_interface_id=eni-0fdc765efad463bbe
++ device_index=2
++ aws ec2 attach-network-interface --device-index 2 --instance-id i-023249c9384517e31 --network-interface-id eni-0fdc765efad463bbe
++ jq -r .AttachmentId
+ attachment_id_2=eni-attach-085e804f0456d52c8
+ sleep 60
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- sudo cloud-init init
Cloud-init v. 20.2-45-g5f7825e2-0ubuntu1~18.04.1 running 'init' at Thu, 11 Jun 2020 15:03:48 +0000. Up 140.78 seconds.
ci-info: +++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++
ci-info: +--------+-------+-----------------------------+---------------+--------+-------------------+
ci-info: | Device |   Up  |           Address           |      Mask     | Scope  |     Hw-Address    |
ci-info: +--------+-------+-----------------------------+---------------+--------+-------------------+
ci-info: |  eth0  |  True |         10.41.41.250        | 255.255.255.0 | global | 06:2d:7e:8f:a5:20 |
ci-info: |  eth0  |  True | fe80::42d:7eff:fe8f:a520/64 |       .       |  link  | 06:2d:7e:8f:a5:20 |
ci-info: |  eth1  | False |              .              |       .       |   .    | 06:c1:55:ae:28:de |
ci-info: |  eth2  | False |              .              |       .       |   .    | 06:d3:de:61:78:e6 |
ci-info: |   lo   |  True |          127.0.0.1          |   255.0.0.0   |  host  |         .         |
ci-info: |   lo   |  True |           ::1/128           |       .       |  host  |         .         |
ci-info: +--------+-------+-----------------------------+---------------+--------+-------------------+
ci-info: +++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++++
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: | Route | Destination |  Gateway   |     Genmask     | Interface | Flags |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: |   0   |   0.0.0.0   | 10.41.41.1 |     0.0.0.0     |    eth0   |   UG  |
ci-info: |   1   |  10.41.41.0 |  0.0.0.0   |  255.255.255.0  |    eth0   |   U   |
ci-info: |   2   |  10.41.41.1 |  0.0.0.0   | 255.255.255.255 |    eth0   |   UH  |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: | Route | Destination | Gateway | Interface | Flags |
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: |   1   |  fe80::/64  |    ::   |    eth0   |   U   |
ci-info: |   3   |    local    |    ::   |    eth0   |   U   |
ci-info: |   4   |   ff00::/8  |    ::   |    eth0   |   U   |
ci-info: +-------+-------------+---------+-----------+-------+
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- sudo cloud-init clean --logs --reboot
Connection to ec2-3-21-230-147.us-east-2.compute.amazonaws.com closed by remote host.
+ true
+ sleep 90
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 15:05:02 +0000
detail:
DataSourceEc2Local
+ date --utc +%s.%N
1591887931.792182232
+ net_file=/etc/netplan/50-cloud-init.yaml
+ '[' bionic = focal ']'
+ '[' bionic = xenial ']'
+ perform_only_eth0_route_verification ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com /etc/netplan/50-cloud-init.yaml
+ ec2_inst=ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
+ net_file=/etc/netplan/50-cloud-init.yaml
+ metric_count_expected=0
++ count_occurrences_in_file /etc/netplan/50-cloud-init.yaml metric
++ search_file=/etc/netplan/50-cloud-init.yaml
++ search_pattern=metric
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- cat /etc/netplan/50-cloud-init.yaml
++ grep metric
++ wc -l
+ metric_count_actual=0
+ '[' 0 = 0 ']'
+ echo 'No metrics as expected'
No metrics as expected
+ metric_count_expected=2
++ count_occurrences_in_file /etc/netplan/50-cloud-init.yaml eth0
++ search_file=/etc/netplan/50-cloud-init.yaml
++ search_pattern=eth0
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- cat /etc/netplan/50-cloud-init.yaml
++ grep eth0
++ wc -l
+ metric_count_actual=2
+ '[' 2 = 2 ']'
+ echo 'eth0 interface rendered'
eth0 interface rendered
+ metric_count_expected=0
++ count_occurrences_in_file /etc/netplan/50-cloud-init.yaml 'eth[12]'
++ search_file=/etc/netplan/50-cloud-init.yaml
++ search_pattern='eth[12]'
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com -- cat /etc/netplan/50-cloud-init.yaml
++ grep 'eth[12]'
++ wc -l
+ metric_count_actual=0
+ '[' 0 = 0 ']'
+ echo 'No eth1 or eth2 interfaces rendered'
No eth1 or eth2 interfaces rendered
+ teardown_network_interface eni-attach-09c4db222f14f7843 eni-08a3fb867f0b2df6e
+ attachment_id=eni-attach-09c4db222f14f7843
+ network_interface_id=eni-08a3fb867f0b2df6e
+ detach_network_interface eni-attach-09c4db222f14f7843
+ attachment_id=eni-attach-09c4db222f14f7843
+ aws ec2 detach-network-interface --attachment-id eni-attach-09c4db222f14f7843
+ sleep 30
+ delete_network_interface eni-08a3fb867f0b2df6e
+ network_interface_id=eni-08a3fb867f0b2df6e
+ aws ec2 delete-network-interface --network-interface-id eni-08a3fb867f0b2df6e
+ teardown_network_interface eni-attach-085e804f0456d52c8 eni-0fdc765efad463bbe
+ attachment_id=eni-attach-085e804f0456d52c8
+ network_interface_id=eni-0fdc765efad463bbe
+ detach_network_interface eni-attach-085e804f0456d52c8
+ attachment_id=eni-attach-085e804f0456d52c8
+ aws ec2 detach-network-interface --attachment-id eni-attach-085e804f0456d52c8
+ sleep 30
+ delete_network_interface eni-0fdc765efad463bbe
+ network_interface_id=eni-0fdc765efad463bbe
+ aws ec2 delete-network-interface --network-interface-id eni-0fdc765efad463bbe
+ echo 'Validating whether metadata is being updated per boot LP:1819913'
Validating whether metadata is being updated per boot LP:1819913
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com 'grep '\''Update datasource'\'' /var/log/cloud-init.log'
2020-06-11 15:04:51,836 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com sudo reboot
Connection to ec2-3-21-230-147.us-east-2.compute.amazonaws.com closed by remote host.
+ true
+ sleep 60
+ echo 'After reboot'
After reboot
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com 'grep '\''Update datasource'\'' /var/log/cloud-init.log'
2020-06-11 15:04:51,836 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:07:41,653 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
+ terminate_instance ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
+ ec2_inst=ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
+ '[' false = false ']'
+ echo 'deleting instance'
deleting instance
++ get_ec2_instance_id ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ dns_name=ubuntu@ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ run_describe_command ec2-3-21-230-147.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].InstanceId'
++ dnsname=ec2-3-21-230-147.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-21-230-147.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].InstanceId'
++ jq -r '.[]'
+ ec2_inst_id=i-023249c9384517e31
+ aws ec2 terminate-instances --instance-ids i-023249c9384517e31
{
    "TerminatingInstances": [
        {
            "CurrentState": {
                "Code": 32,
                "Name": "shutting-down"
            },
            "InstanceId": "i-023249c9384517e31",
            "PreviousState": {
                "Code": 16,
                "Name": "running"
            }
        }
    ]
}
+ echo '### END bionic'
### END bionic
+ for series in $SRU_SERIES
+ echo '### BEGIN eoan'
### BEGIN eoan
++ launch-ec2 --series eoan -u sethostname.yaml -t t2.small
++ awk '/Found/{print $5}'
+ EC2_INST=ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
+ '[' -n ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com ']'
+ sleep 60
+ trap 'terminate_instance ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com' ERR
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 15:09:57 +0000
detail:
DataSourceEc2Local
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- cat /run/cloud-init/result.json
{
 "v1": {
  "datasource": "DataSourceEc2Local",
  "errors": []
 }
}
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init.*'
+ echo 'Expect IMDSv2 token headers are being used on all metadata gets. Expect 0 line count'
Expect IMDSv2 token headers are being used on all metadata gets. Expect 0 line count
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- '[[ 0 = `grep headers /var/log/cloud-init.log  | grep -c -v X-aws` ]] || exit 1'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- sudo systemd-analyze
Startup finished in 3.347s (kernel) + 1min 818ms (userspace) = 1min 4.165s 
graphical.target reached after 1min 56ms in userspace
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- sudo systemd-analyze blame
         38.382s snapd.seeded.service
          4.712s cloud-init-local.service
          3.828s cloud-config.service
          2.771s lvm2-monitor.service
          2.686s pollinate.service
          2.586s dev-xvda1.device
          2.264s systemd-udev-settle.service
          1.827s cloud-init.service
          1.811s systemd-networkd-wait-online.service
          1.257s snapd.service
          1.125s accounts-daemon.service
          1.118s apparmor.service
           853ms systemd-logind.service
           739ms apport.service
           729ms cloud-final.service
           721ms grub-common.service
           649ms rsyslog.service
           596ms networkd-dispatcher.service
           595ms systemd-udevd.service
           561ms systemd-timesyncd.service
           535ms systemd-journald.service
           403ms grub-initrd-fallback.service
           371ms snap.lxd.activate.service
           344ms systemd-udev-trigger.service
           320ms multipathd.service
           286ms systemd-resolved.service
           272ms keyboard-setup.service
           260ms systemd-networkd.service
           209ms systemd-sysusers.service
           207ms snapd.socket
           200ms systemd-user-sessions.service
           187ms plymouth-quit.service
           183ms plymouth-quit-wait.service
           159ms ssh.service
           158ms dev-hugepages.mount
           157ms systemd-modules-load.service
           155ms systemd-remount-fs.service
           154ms kmod-static-nodes.service
           154ms dev-mqueue.mount
           146ms ufw.service
           137ms sys-kernel-debug.mount
           133ms polkit.service
           123ms systemd-sysctl.service
           120ms hibinit-agent.service
           119ms sys-fs-fuse-connections.mount
           119ms console-setup.service
           113ms sys-kernel-config.mount
           112ms plymouth-read-write.service
           111ms systemd-journal-flush.service
           110ms systemd-random-seed.service
           110ms systemd-tmpfiles-setup.service
           107ms systemd-machine-id-commit.service
           105ms user@1000.service
            96ms finalrd.service
            82ms atd.service
            62ms systemd-update-utmp.service
            59ms setvtrgb.service
            55ms blk-availability.service
            47ms dev-loop2.device
            43ms systemd-update-utmp-runlevel.service
            41ms snap-core-9289.mount
            30ms snap-core18-1754.mount
            29ms snap-lxd-15457.mount
            28ms snap-amazon\x2dssm\x2dagent-1566.mount
            26ms dev-loop0.device
            24ms dev-loop1.device
            20ms dev-loop3.device
            18ms systemd-tmpfiles-setup-dev.service
            18ms user-runtime-dir@1000.service
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- sudo cloud-init analyze show
-- Boot Record 01 --
The total time elapsed since completing an event is printed after the "@" character.
The time the event takes is printed after the "+" character.

Starting stage: init-local
|`->no cache found @00.00500s +00.00000s
|`->found local data from DataSourceEc2Local @00.01200s +00.79100s
Finished stage: (init-local) 01.06800 seconds

Starting stage: init-network
|`->restored from cache with run check: DataSourceEc2Local @03.65800s +00.00300s
|`->setting up datasource @03.71900s +00.00000s
|`->reading and applying user-data @03.72600s +00.00700s
|`->reading and applying vendor-data @03.73300s +00.00000s
|`->activating datasource @03.76900s +00.00100s
|`->config-migrator ran successfully @03.83700s +00.00000s
|`->config-seed_random ran successfully @03.83800s +00.00000s
|`->config-bootcmd ran successfully @03.83900s +00.00000s
|`->config-write-files ran successfully @03.83900s +00.01000s
|`->config-growpart ran successfully @03.84900s +00.20900s
|`->config-resizefs ran successfully @04.05800s +00.16100s
|`->config-disk_setup ran successfully @04.22000s +00.00100s
|`->config-mounts ran successfully @04.22100s +00.00100s
|`->config-set_hostname ran successfully @04.22200s +00.00500s
|`->config-update_hostname ran successfully @04.22800s +00.00100s
|`->config-update_etc_hosts ran successfully @04.22900s +00.00000s
|`->config-ca-certs ran successfully @04.22900s +00.00100s
|`->config-rsyslog ran successfully @04.23000s +00.00100s
|`->config-users-groups ran successfully @04.23100s +00.33800s
|`->config-ssh ran successfully @04.56900s +00.41300s
Finished stage: (init-network) 01.33900 seconds

Starting stage: modules-config
|`->config-emit_upstart ran successfully @47.11500s +00.00000s
|`->config-snap ran successfully @47.11600s +00.00000s
|`->config-ssh-import-id ran successfully @47.11700s +01.05000s
|`->config-locale ran successfully @48.16700s +00.00100s
|`->config-set-passwords ran successfully @48.16900s +00.00000s
|`->config-grub-dpkg ran successfully @48.17000s +02.16200s
|`->config-apt-pipelining ran successfully @50.33200s +00.00100s
|`->config-apt-configure ran successfully @50.33300s +00.09600s
|`->config-ubuntu-advantage ran successfully @50.42900s +00.00100s
|`->config-ntp ran successfully @50.43000s +00.00100s
|`->config-timezone ran successfully @50.43100s +00.00000s
|`->config-disable-ec2-metadata ran successfully @50.43200s +00.00000s
|`->config-runcmd ran successfully @50.43200s +00.00100s
|`->config-byobu ran successfully @50.43300s +00.00000s
Finished stage: (modules-config) 03.33700 seconds

Starting stage: modules-final
|`->config-package-update-upgrade-install ran successfully @51.12200s +00.00000s
|`->config-fan ran successfully @51.12200s +00.00100s
|`->config-landscape ran successfully @51.12300s +00.00100s
|`->config-lxd ran successfully @51.12400s +00.00100s
|`->config-ubuntu-drivers ran successfully @51.12500s +00.00100s
|`->config-puppet ran successfully @51.12600s +00.00000s
|`->config-chef ran successfully @51.12700s +00.00000s
|`->config-mcollective ran successfully @51.12700s +00.00100s
|`->config-salt-minion ran successfully @51.12800s +00.00100s
|`->config-rightscale_userdata ran successfully @51.12900s +00.00100s
|`->config-scripts-vendor ran successfully @51.13000s +00.00100s
|`->config-scripts-per-once ran successfully @51.13100s +00.00000s
|`->config-scripts-per-boot ran successfully @51.13200s +00.00000s
|`->config-scripts-per-instance ran successfully @51.13200s +00.00100s
|`->config-scripts-user ran successfully @51.13300s +00.00000s
|`->config-ssh-authkey-fingerprints ran successfully @51.13400s +00.02900s
|`->config-keys-to-console ran successfully @51.16300s +00.13400s
|`->config-phone-home ran successfully @51.29800s +00.00100s
|`->config-final-message ran successfully @51.29900s +00.00400s
|`->config-power-state-change ran successfully @51.30300s +00.00100s
Finished stage: (modules-final) 00.20800 seconds

Total Time: 5.95200 seconds

1 boot records analyzed
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- '!' sudo grep Trace '/var/log/cloud-init*'
+ scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR setup_dev_proposed.sh ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com:
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com sudo bash setup_dev_proposed.sh
+ egrep cloud-init
Get:6 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu eoan InRelease [15.9 kB]
Get:28 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu eoan/main amd64 Packages [648 B]
Get:30 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu eoan/main Translation-en [248 B]
Hit:4 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu eoan InRelease
  cloud-init
Get:1 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu eoan/main amd64 cloud-init all 20.2-45-g5f7825e2-0ubuntu1~19.10.1 [470 kB]
Preparing to unpack .../cloud-init_20.2-45-g5f7825e2-0ubuntu1~19.10.1_all.deb ...
Unpacking cloud-init (20.2-45-g5f7825e2-0ubuntu1~19.10.1) over (19.4-33-gbb4131a2-0ubuntu1~19.10.1) ...
Setting up cloud-init (20.2-45-g5f7825e2-0ubuntu1~19.10.1) ...
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com sudo hostname something-else
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- sudo cloud-init init
Cloud-init v. 20.2-45-g5f7825e2-0ubuntu1~19.10.1 running 'init' at Thu, 11 Jun 2020 15:12:16 +0000. Up 203.27 seconds.
ci-info: ++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: | Device |  Up  |           Address           |      Mask     | Scope  |     Hw-Address    |
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: |  eth0  | True |         10.41.41.37         | 255.255.255.0 | global | 06:e4:19:a1:45:b6 |
ci-info: |  eth0  | True | fe80::4e4:19ff:fea1:45b6/64 |       .       |  link  | 06:e4:19:a1:45:b6 |
ci-info: |   lo   | True |          127.0.0.1          |   255.0.0.0   |  host  |         .         |
ci-info: |   lo   | True |           ::1/128           |       .       |  host  |         .         |
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: +++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++++
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: | Route | Destination |  Gateway   |     Genmask     | Interface | Flags |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: |   0   |   0.0.0.0   | 10.41.41.1 |     0.0.0.0     |    eth0   |   UG  |
ci-info: |   1   |  10.41.41.0 |  0.0.0.0   |  255.255.255.0  |    eth0   |   U   |
ci-info: |   2   |  10.41.41.1 |  0.0.0.0   | 255.255.255.255 |    eth0   |   UH  |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: | Route | Destination | Gateway | Interface | Flags |
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: |   1   |  fe80::/64  |    ::   |    eth0   |   U   |
ci-info: |   3   |    local    |    ::   |    eth0   |   U   |
ci-info: |   4   |   ff00::/8  |    ::   |    eth0   |   U   |
ci-info: +-------+-------------+---------+-----------+-------+
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- sudo cloud-init clean --logs --reboot
Connection to ec2-3-133-105-240.us-east-2.compute.amazonaws.com closed by remote host.
+ true
+ sleep 60
+ date --utc +%s.%N
1591888410.246295979
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 15:13:13 +0000
detail:
DataSourceEc2Local
+ date --utc +%s.%N
1591888415.643743758
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- hostname
SRU-worked-aws
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- sudo systemd-analyze
Startup finished in 1.702s (kernel) + 14.281s (userspace) = 15.984s 
graphical.target reached after 13.595s in userspace
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- sudo cloud-init analyze show
-- Boot Record 01 --
The total time elapsed since completing an event is printed after the "@" character.
The time the event takes is printed after the "+" character.

Starting stage: init-local
|`->no cache found @00.00400s +00.00100s
|`->found local data from DataSourceEc2Local @00.01300s +00.38300s
Finished stage: (init-local) 00.58400 seconds

Starting stage: init-network
|`->restored from cache with run check: DataSourceEc2Local @03.06100s +00.00300s
|`->setting up datasource @03.12200s +00.00000s
|`->reading and applying user-data @03.12800s +00.01900s
|`->reading and applying vendor-data @03.14700s +00.00000s
|`->activating datasource @03.17900s +00.00100s
|`->config-migrator ran successfully @03.21800s +00.00000s
|`->config-seed_random ran successfully @03.21900s +00.00000s
|`->config-bootcmd ran successfully @03.22000s +00.00000s
|`->config-write-files ran successfully @03.22000s +00.00100s
|`->config-growpart ran successfully @03.22700s +00.13700s
|`->config-resizefs ran successfully @03.36400s +00.05400s
|`->config-disk_setup ran successfully @03.41800s +00.00100s
|`->config-mounts ran successfully @03.42000s +00.00100s
|`->config-set_hostname ran successfully @03.42100s +00.00500s
|`->config-update_hostname ran successfully @03.42600s +00.00100s
|`->config-update_etc_hosts ran successfully @03.42800s +00.00000s
|`->config-ca-certs ran successfully @03.42800s +00.00100s
|`->config-rsyslog ran successfully @03.42900s +00.00100s
|`->config-users-groups ran successfully @03.43000s +00.01600s
|`->config-ssh ran successfully @03.44600s +00.32400s
Finished stage: (init-network) 00.72800 seconds

Starting stage: modules-config
|`->config-emit_upstart ran successfully @08.25100s +00.00000s
|`->config-snap ran successfully @08.25100s +00.00100s
|`->config-ssh-import-id ran successfully @08.25200s +00.90900s
|`->config-locale ran successfully @09.16200s +00.01800s
|`->config-set-passwords ran successfully @09.18000s +00.00100s
|`->config-grub-dpkg ran successfully @09.18100s +00.42000s
|`->config-apt-pipelining ran successfully @09.60200s +00.00100s
|`->config-apt-configure ran successfully @09.60300s +00.14000s
|`->config-ubuntu-advantage ran successfully @09.74300s +00.00100s
|`->config-ntp ran successfully @09.74400s +00.00100s
|`->config-timezone ran successfully @09.74500s +00.00100s
|`->config-disable-ec2-metadata ran successfully @09.74600s +00.00000s
|`->config-runcmd ran successfully @09.74600s +00.00100s
|`->config-byobu ran successfully @09.74700s +00.00100s
Finished stage: (modules-config) 01.51600 seconds

Starting stage: modules-final
|`->config-package-update-upgrade-install ran successfully @10.50900s +00.00100s
|`->config-fan ran successfully @10.51000s +00.00100s
|`->config-landscape ran successfully @10.51100s +00.00100s
|`->config-lxd ran successfully @10.51200s +00.00000s
|`->config-ubuntu-drivers ran successfully @10.51300s +00.00000s
|`->config-puppet ran successfully @10.51400s +00.00000s
|`->config-chef ran successfully @10.51400s +00.00100s
|`->config-mcollective ran successfully @10.51500s +00.00100s
|`->config-salt-minion ran successfully @10.51600s +00.00100s
|`->config-rightscale_userdata ran successfully @10.51700s +00.00000s
|`->config-scripts-vendor ran successfully @10.51800s +00.00000s
|`->config-scripts-per-once ran successfully @10.51800s +00.00100s
|`->config-scripts-per-boot ran successfully @10.51900s +00.00000s
|`->config-scripts-per-instance ran successfully @10.52000s +00.00000s
|`->config-scripts-user ran successfully @10.52000s +00.00100s
|`->config-ssh-authkey-fingerprints ran successfully @10.52100s +00.04800s
|`->config-keys-to-console ran successfully @10.57000s +00.08400s
|`->config-phone-home ran successfully @10.65500s +00.00100s
|`->config-final-message ran successfully @10.65600s +00.00400s
|`->config-power-state-change ran successfully @10.66100s +00.00000s
Finished stage: (modules-final) 00.17300 seconds

Total Time: 3.00100 seconds

1 boot records analyzed
+ '[' eoan = xenial ']'
+ echo '--- Expect success on bionic for jinja because deb DOES have jinja dep.'
--- Expect success on bionic for jinja because deb DOES have jinja dep.
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com 'cloud-init query --format '\''cloud-region: {{cloud_name}}-{{region}}'\'''
cloud-region: aws-us-east-2
+ echo 'Get cloud-id'
Get cloud-id
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com cloud-id
aws
+ echo 'Per LP:1863943 we should hide IMDSv2 tokens on the log'
Per LP:1863943 we should hide IMDSv2 tokens on the log
+ perform_imds_hidden_token_verification ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
+ ec2_inst=ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
+ search_file=/var/log/cloud-init.log
+ search_pattern=''\''X-aws-ec2-metadata-token'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token'\'''
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token'\'''
++ wc -l
+ num_token_key=67
+ search_pattern=''\''X-aws-ec2-metadata-token'\'': '\''REDACTED'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token'\'':' ''\''REDACTED'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token'\'':'
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token'\'':'
++ wc -l
+ num_token_key_redacted=67
+ '[' 67 = 67 ']'
+ echo 'X-aws-ec2-metadata-token are correctly appearing as redacted in logs'
X-aws-ec2-metadata-token are correctly appearing as redacted in logs
+ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ wc -l
+ num_token_key=1
+ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'': '\''REDACTED'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token-ttl-seconds'\'':' ''\''REDACTED'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'':'
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ wc -l
++ grep ''\''X-aws-ec2-metadata-token-ttl-seconds'\'':'
+ num_token_key_redacted=1
+ '[' 1 = 1 ']'
+ echo 'X-aws-ec2-metadata-token-ttl-seconds are correctly appearing as redacted in logs'
X-aws-ec2-metadata-token-ttl-seconds are correctly appearing as redacted in logs
+ echo 'Per LP:1876312 should route based on device-number not on mac address'
Per LP:1876312 should route based on device-number not on mac address
+ echo 'Per LP:1866930 should configure other network interfaces from imds data'
Per LP:1866930 should configure other network interfaces from imds data
+ echo 'However LP:1866930 does not apply to Bionic, Eoan and Xenial'
However LP:1866930 does not apply to Bionic, Eoan and Xenial
+ perform_nic_ordering_test ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com eoan
+ ec2_inst=ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
+ series=eoan
++ get_ec2_instance_id ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ dns_name=ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ run_describe_command ec2-3-133-105-240.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].InstanceId'
++ dnsname=ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-133-105-240.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].InstanceId'
++ jq -r '.[]'
+ instance_id=i-01981eeae2c511da0
++ get_subnet_id ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ inst_name=ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].SubnetId'
++ run_describe_command ec2-3-133-105-240.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].SubnetId'
++ dnsname=ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].SubnetId'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-133-105-240.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].SubnetId'
++ jq -r '.[]'
+ subnet_id=subnet-0afec7d3c136a3ccb
+ echo 'Creating two nic to test feature...'
Creating two nic to test feature...
++ setup_network_interface subnet-0afec7d3c136a3ccb
++ subnet_id=subnet-0afec7d3c136a3ccb
+++ create_network_interface subnet-0afec7d3c136a3ccb
+++ subnet_id=subnet-0afec7d3c136a3ccb
+++ aws ec2 create-network-interface --subnet-id subnet-0afec7d3c136a3ccb
++ network_interface_json='{
    "NetworkInterface": {
        "AvailabilityZone": "us-east-2b",
        "Description": "",
        "Groups": [
            {
                "GroupName": "default",
                "GroupId": "sg-0c3f58efd82634f04"
            }
        ],
        "InterfaceType": "interface",
        "Ipv6Addresses": [],
        "MacAddress": "06:bf:1c:ae:60:74",
        "NetworkInterfaceId": "eni-07e57b6bbbb44b769",
        "OwnerId": "329688318733",
        "PrivateDnsName": "ip-10-41-41-55.us-east-2.compute.internal",
        "PrivateIpAddress": "10.41.41.55",
        "PrivateIpAddresses": [
            {
                "Primary": true,
                "PrivateDnsName": "ip-10-41-41-55.us-east-2.compute.internal",
                "PrivateIpAddress": "10.41.41.55"
            }
        ],
        "RequesterManaged": false,
        "SourceDestCheck": true,
        "Status": "pending",
        "SubnetId": "subnet-0afec7d3c136a3ccb",
        "TagSet": [],
        "VpcId": "vpc-019733e0f085e012a"
    }
}'
++ get_network_interface_id '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:bf:1c:ae:60:74",' '"NetworkInterfaceId":' '"eni-07e57b6bbbb44b769",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-55.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.55",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-55.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.55"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
++ network_interface_json='{ "NetworkInterface": { "AvailabilityZone": "us-east-2b", "Description": "", "Groups": [ { "GroupName": "default", "GroupId": "sg-0c3f58efd82634f04" } ], "InterfaceType": "interface", "Ipv6Addresses": [], "MacAddress": "06:bf:1c:ae:60:74", "NetworkInterfaceId": "eni-07e57b6bbbb44b769", "OwnerId": "329688318733", "PrivateDnsName": "ip-10-41-41-55.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.55", "PrivateIpAddresses": [ { "Primary": true, "PrivateDnsName": "ip-10-41-41-55.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.55" } ], "RequesterManaged": false, "SourceDestCheck": true, "Status": "pending", "SubnetId": "subnet-0afec7d3c136a3ccb", "TagSet": [], "VpcId": "vpc-019733e0f085e012a" } }'
++ jq -r .NetworkInterface.NetworkInterfaceId
++ echo '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:bf:1c:ae:60:74",' '"NetworkInterfaceId":' '"eni-07e57b6bbbb44b769",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-55.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.55",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-55.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.55"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
+ network_interface_id_1=eni-07e57b6bbbb44b769
++ setup_network_interface subnet-0afec7d3c136a3ccb
++ subnet_id=subnet-0afec7d3c136a3ccb
+++ create_network_interface subnet-0afec7d3c136a3ccb
+++ subnet_id=subnet-0afec7d3c136a3ccb
+++ aws ec2 create-network-interface --subnet-id subnet-0afec7d3c136a3ccb
++ network_interface_json='{
    "NetworkInterface": {
        "AvailabilityZone": "us-east-2b",
        "Description": "",
        "Groups": [
            {
                "GroupName": "default",
                "GroupId": "sg-0c3f58efd82634f04"
            }
        ],
        "InterfaceType": "interface",
        "Ipv6Addresses": [],
        "MacAddress": "06:cb:0c:ef:33:2c",
        "NetworkInterfaceId": "eni-074fd481bab16bcd0",
        "OwnerId": "329688318733",
        "PrivateDnsName": "ip-10-41-41-138.us-east-2.compute.internal",
        "PrivateIpAddress": "10.41.41.138",
        "PrivateIpAddresses": [
            {
                "Primary": true,
                "PrivateDnsName": "ip-10-41-41-138.us-east-2.compute.internal",
                "PrivateIpAddress": "10.41.41.138"
            }
        ],
        "RequesterManaged": false,
        "SourceDestCheck": true,
        "Status": "pending",
        "SubnetId": "subnet-0afec7d3c136a3ccb",
        "TagSet": [],
        "VpcId": "vpc-019733e0f085e012a"
    }
}'
++ get_network_interface_id '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:cb:0c:ef:33:2c",' '"NetworkInterfaceId":' '"eni-074fd481bab16bcd0",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-138.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.138",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-138.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.138"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
++ network_interface_json='{ "NetworkInterface": { "AvailabilityZone": "us-east-2b", "Description": "", "Groups": [ { "GroupName": "default", "GroupId": "sg-0c3f58efd82634f04" } ], "InterfaceType": "interface", "Ipv6Addresses": [], "MacAddress": "06:cb:0c:ef:33:2c", "NetworkInterfaceId": "eni-074fd481bab16bcd0", "OwnerId": "329688318733", "PrivateDnsName": "ip-10-41-41-138.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.138", "PrivateIpAddresses": [ { "Primary": true, "PrivateDnsName": "ip-10-41-41-138.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.138" } ], "RequesterManaged": false, "SourceDestCheck": true, "Status": "pending", "SubnetId": "subnet-0afec7d3c136a3ccb", "TagSet": [], "VpcId": "vpc-019733e0f085e012a" } }'
++ echo '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:cb:0c:ef:33:2c",' '"NetworkInterfaceId":' '"eni-074fd481bab16bcd0",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-138.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.138",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-138.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.138"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
++ jq -r .NetworkInterface.NetworkInterfaceId
+ network_interface_id_2=eni-074fd481bab16bcd0
+ echo 'Attaching network interfaces to instance...'
Attaching network interfaces to instance...
++ attach_network_interface i-01981eeae2c511da0 eni-07e57b6bbbb44b769 1
++ instance_id=i-01981eeae2c511da0
++ network_interface_id=eni-07e57b6bbbb44b769
++ device_index=1
++ aws ec2 attach-network-interface --device-index 1 --instance-id i-01981eeae2c511da0 --network-interface-id eni-07e57b6bbbb44b769
++ jq -r .AttachmentId
+ attachment_id_1=eni-attach-05f137affcf25919e
++ attach_network_interface i-01981eeae2c511da0 eni-074fd481bab16bcd0 2
++ instance_id=i-01981eeae2c511da0
++ network_interface_id=eni-074fd481bab16bcd0
++ device_index=2
++ aws ec2 attach-network-interface --device-index 2 --instance-id i-01981eeae2c511da0 --network-interface-id eni-074fd481bab16bcd0
++ jq -r .AttachmentId
+ attachment_id_2=eni-attach-0e58a1d174325d62f
+ sleep 60
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- sudo cloud-init init
Cloud-init v. 20.2-45-g5f7825e2-0ubuntu1~19.10.1 running 'init' at Thu, 11 Jun 2020 15:15:47 +0000. Up 169.39 seconds.
ci-info: +++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++
ci-info: +--------+-------+-----------------------------+---------------+--------+-------------------+
ci-info: | Device |   Up  |           Address           |      Mask     | Scope  |     Hw-Address    |
ci-info: +--------+-------+-----------------------------+---------------+--------+-------------------+
ci-info: |  eth0  |  True |         10.41.41.37         | 255.255.255.0 | global | 06:e4:19:a1:45:b6 |
ci-info: |  eth0  |  True | fe80::4e4:19ff:fea1:45b6/64 |       .       |  link  | 06:e4:19:a1:45:b6 |
ci-info: |  eth1  | False |              .              |       .       |   .    | 06:bf:1c:ae:60:74 |
ci-info: |  eth2  | False |              .              |       .       |   .    | 06:cb:0c:ef:33:2c |
ci-info: |   lo   |  True |          127.0.0.1          |   255.0.0.0   |  host  |         .         |
ci-info: |   lo   |  True |           ::1/128           |       .       |  host  |         .         |
ci-info: +--------+-------+-----------------------------+---------------+--------+-------------------+
ci-info: +++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++++
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: | Route | Destination |  Gateway   |     Genmask     | Interface | Flags |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: |   0   |   0.0.0.0   | 10.41.41.1 |     0.0.0.0     |    eth0   |   UG  |
ci-info: |   1   |  10.41.41.0 |  0.0.0.0   |  255.255.255.0  |    eth0   |   U   |
ci-info: |   2   |  10.41.41.1 |  0.0.0.0   | 255.255.255.255 |    eth0   |   UH  |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: | Route | Destination | Gateway | Interface | Flags |
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: |   1   |  fe80::/64  |    ::   |    eth0   |   U   |
ci-info: |   3   |    local    |    ::   |    eth0   |   U   |
ci-info: |   4   |   ff00::/8  |    ::   |    eth0   |   U   |
ci-info: +-------+-------------+---------+-----------+-------+
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- sudo cloud-init clean --logs --reboot
+ sleep 90
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 15:16:54 +0000
detail:
DataSourceEc2Local
+ date --utc +%s.%N
1591888647.945899487
+ net_file=/etc/netplan/50-cloud-init.yaml
+ '[' eoan = focal ']'
+ '[' eoan = xenial ']'
+ perform_only_eth0_route_verification ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com /etc/netplan/50-cloud-init.yaml
+ ec2_inst=ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
+ net_file=/etc/netplan/50-cloud-init.yaml
+ metric_count_expected=0
++ count_occurrences_in_file /etc/netplan/50-cloud-init.yaml metric
++ search_file=/etc/netplan/50-cloud-init.yaml
++ search_pattern=metric
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- cat /etc/netplan/50-cloud-init.yaml
++ grep metric
++ wc -l
+ metric_count_actual=0
+ '[' 0 = 0 ']'
+ echo 'No metrics as expected'
No metrics as expected
+ metric_count_expected=2
++ count_occurrences_in_file /etc/netplan/50-cloud-init.yaml eth0
++ search_file=/etc/netplan/50-cloud-init.yaml
++ search_pattern=eth0
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- cat /etc/netplan/50-cloud-init.yaml
++ wc -l
++ grep eth0
+ metric_count_actual=2
+ '[' 2 = 2 ']'
+ echo 'eth0 interface rendered'
eth0 interface rendered
+ metric_count_expected=0
++ count_occurrences_in_file /etc/netplan/50-cloud-init.yaml 'eth[12]'
++ search_file=/etc/netplan/50-cloud-init.yaml
++ search_pattern='eth[12]'
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com -- cat /etc/netplan/50-cloud-init.yaml
++ grep 'eth[12]'
++ wc -l
+ metric_count_actual=0
+ '[' 0 = 0 ']'
+ echo 'No eth1 or eth2 interfaces rendered'
No eth1 or eth2 interfaces rendered
+ teardown_network_interface eni-attach-05f137affcf25919e eni-07e57b6bbbb44b769
+ attachment_id=eni-attach-05f137affcf25919e
+ network_interface_id=eni-07e57b6bbbb44b769
+ detach_network_interface eni-attach-05f137affcf25919e
+ attachment_id=eni-attach-05f137affcf25919e
+ aws ec2 detach-network-interface --attachment-id eni-attach-05f137affcf25919e
+ sleep 30
+ delete_network_interface eni-07e57b6bbbb44b769
+ network_interface_id=eni-07e57b6bbbb44b769
+ aws ec2 delete-network-interface --network-interface-id eni-07e57b6bbbb44b769
+ teardown_network_interface eni-attach-0e58a1d174325d62f eni-074fd481bab16bcd0
+ attachment_id=eni-attach-0e58a1d174325d62f
+ network_interface_id=eni-074fd481bab16bcd0
+ detach_network_interface eni-attach-0e58a1d174325d62f
+ attachment_id=eni-attach-0e58a1d174325d62f
+ aws ec2 detach-network-interface --attachment-id eni-attach-0e58a1d174325d62f
+ sleep 30
+ delete_network_interface eni-074fd481bab16bcd0
+ network_interface_id=eni-074fd481bab16bcd0
+ aws ec2 delete-network-interface --network-interface-id eni-074fd481bab16bcd0
+ echo 'Validating whether metadata is being updated per boot LP:1819913'
Validating whether metadata is being updated per boot LP:1819913
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com 'grep '\''Update datasource'\'' /var/log/cloud-init.log'
2020-06-11 15:16:44,341 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com sudo reboot
+ sleep 60
+ echo 'After reboot'
After reboot
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com 'grep '\''Update datasource'\'' /var/log/cloud-init.log'
2020-06-11 15:16:44,341 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:19:30,632 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
+ terminate_instance ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
+ ec2_inst=ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
+ '[' false = false ']'
+ echo 'deleting instance'
deleting instance
++ get_ec2_instance_id ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ dns_name=ubuntu@ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ run_describe_command ec2-3-133-105-240.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].InstanceId'
++ dnsname=ec2-3-133-105-240.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-133-105-240.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].InstanceId'
++ jq -r '.[]'
+ ec2_inst_id=i-01981eeae2c511da0
+ aws ec2 terminate-instances --instance-ids i-01981eeae2c511da0
{
    "TerminatingInstances": [
        {
            "CurrentState": {
                "Code": 32,
                "Name": "shutting-down"
            },
            "InstanceId": "i-01981eeae2c511da0",
            "PreviousState": {
                "Code": 16,
                "Name": "running"
            }
        }
    ]
}
+ echo '### END eoan'
### END eoan
+ for series in $SRU_SERIES
+ echo '### BEGIN focal'
### BEGIN focal
++ launch-ec2 --series focal -u sethostname.yaml -t t2.small
++ awk '/Found/{print $5}'
+ EC2_INST=ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
+ '[' -n ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com ']'
+ sleep 60
+ trap 'terminate_instance ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com' ERR
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 15:21:03 +0000
detail:
DataSourceEc2Local
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- cat /run/cloud-init/result.json
{
 "v1": {
  "datasource": "DataSourceEc2Local",
  "errors": []
 }
}
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init.*'
+ echo 'Expect IMDSv2 token headers are being used on all metadata gets. Expect 0 line count'
Expect IMDSv2 token headers are being used on all metadata gets. Expect 0 line count
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- '[[ 0 = `grep headers /var/log/cloud-init.log  | grep -c -v X-aws` ]] || exit 1'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- sudo systemd-analyze
Startup finished in 1.880s (kernel) + 34.451s (userspace) = 36.332s 
graphical.target reached after 33.664s in userspace
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- sudo systemd-analyze blame
21.539s snapd.seeded.service                  
 1.925s cloud-config.service                  
 1.724s lvm2-monitor.service                  
 1.672s systemd-logind.service                
 1.612s systemd-networkd-wait-online.service  
 1.498s accounts-daemon.service               
 1.431s dev-xvda1.device                      
 1.350s pollinate.service                     
 1.317s cloud-init.service                    
 1.257s apparmor.service                      
 1.257s cloud-init-local.service              
 1.192s ec2-instance-connect.service          
 1.085s snapd.service                         
 1.007s systemd-udev-settle.service           
  855ms apport.service                        
  829ms systemd-journald.service              
  761ms cloud-final.service                   
  699ms systemd-timesyncd.service             
  660ms networkd-dispatcher.service           
  594ms grub-common.service                   
  510ms systemd-udev-trigger.service          
  461ms sys-kernel-tracing.mount              
  454ms sys-kernel-debug.mount                
  447ms keyboard-setup.service                
  446ms dev-mqueue.mount                      
  435ms dev-hugepages.mount                   
  432ms kmod-static-nodes.service             
  431ms atd.service                           
  426ms grub-initrd-fallback.service          
  393ms e2scrub_reap.service                  
  393ms snap.lxd.activate.service             
  362ms rsyslog.service                       
  352ms systemd-resolved.service              
  316ms systemd-networkd.service              
  306ms modprobe@drm.service                  
  289ms systemd-remount-fs.service            
  284ms systemd-modules-load.service          
  249ms ufw.service                           
  192ms sys-fs-fuse-connections.mount         
  180ms polkit.service                        
  153ms plymouth-quit-wait.service            
  153ms sys-kernel-config.mount               
  151ms plymouth-quit.service                 
  149ms systemd-user-sessions.service         
  132ms systemd-machine-id-commit.service     
  131ms finalrd.service                       
  131ms plymouth-read-write.service           
  128ms systemd-tmpfiles-setup.service        
  127ms hibinit-agent.service                 
  126ms console-setup.service                 
  110ms user@1000.service                     
   95ms ssh.service                           
   95ms multipathd.service                    
   92ms systemd-sysusers.service              
   73ms snapd.socket                          
   71ms systemd-random-seed.service           
   70ms setvtrgb.service                      
   63ms systemd-sysctl.service                
   51ms snap-amazon\x2dssm\x2dagent-1566.mount
   46ms systemd-update-utmp-runlevel.service  
   45ms systemd-udevd.service                 
   41ms systemd-journal-flush.service         
   37ms snapd.apparmor.service                
   36ms blk-availability.service              
   33ms snap-core-9289.mount                  
   32ms systemd-update-utmp.service           
   32ms snap-lxd-15457.mount                  
   31ms snap-core18-1754.mount                
   24ms dev-loop0.device                      
   23ms dev-loop2.device                      
   18ms dev-loop3.device                      
   18ms systemd-tmpfiles-setup-dev.service    
   18ms dev-loop1.device                      
   16ms user-runtime-dir@1000.service         
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- sudo cloud-init analyze show
-- Boot Record 01 --
The total time elapsed since completing an event is printed after the "@" character.
The time the event takes is printed after the "+" character.

Starting stage: init-local
|`->no cache found @00.00500s +00.00000s
|`->found local data from DataSourceEc2Local @00.01200s +00.31100s
Finished stage: (init-local) 00.50300 seconds

Starting stage: init-network
|`->restored from cache with run check: DataSourceEc2Local @02.93900s +00.00300s
|`->setting up datasource @03.00500s +00.00000s
|`->reading and applying user-data @03.01100s +00.00700s
|`->reading and applying vendor-data @03.01800s +00.00000s
|`->activating datasource @03.04700s +00.00100s
|`->config-migrator ran successfully @03.09200s +00.00000s
|`->config-seed_random ran successfully @03.09200s +00.00100s
|`->config-bootcmd ran successfully @03.09300s +00.00100s
|`->config-write-files ran successfully @03.09400s +00.00000s
|`->config-growpart ran successfully @03.09500s +00.13900s
|`->config-resizefs ran successfully @03.23400s +00.13700s
|`->config-disk_setup ran successfully @03.37200s +00.00100s
|`->config-mounts ran successfully @03.37300s +00.00200s
|`->config-set_hostname ran successfully @03.37500s +00.00500s
|`->config-update_hostname ran successfully @03.38000s +00.00200s
|`->config-update_etc_hosts ran successfully @03.38200s +00.00000s
|`->config-ca-certs ran successfully @03.38200s +00.00100s
|`->config-rsyslog ran successfully @03.38300s +00.00100s
|`->config-users-groups ran successfully @03.38400s +00.07500s
|`->config-ssh ran successfully @03.45900s +00.25000s
Finished stage: (init-network) 00.78500 seconds

Starting stage: modules-config
|`->config-emit_upstart ran successfully @27.38700s +00.00100s
|`->config-snap ran successfully @27.38800s +00.00100s
|`->config-ssh-import-id ran successfully @27.38900s +00.83300s
|`->config-locale ran successfully @28.22300s +00.00100s
|`->config-set-passwords ran successfully @28.22400s +00.00100s
|`->config-grub-dpkg ran successfully @28.22500s +00.30800s
|`->config-apt-pipelining ran successfully @28.53400s +00.00000s
|`->config-apt-configure ran successfully @28.53500s +00.20900s
|`->config-ubuntu-advantage ran successfully @28.74400s +00.00100s
|`->config-ntp ran successfully @28.74500s +00.00100s
|`->config-timezone ran successfully @28.74600s +00.00100s
|`->config-disable-ec2-metadata ran successfully @28.74700s +00.00000s
|`->config-runcmd ran successfully @28.74800s +00.00000s
|`->config-byobu ran successfully @28.74800s +00.00100s
Finished stage: (modules-config) 01.37900 seconds

Starting stage: modules-final
|`->config-package-update-upgrade-install ran successfully @29.49800s +00.00100s
|`->config-fan ran successfully @29.49900s +00.00100s
|`->config-landscape ran successfully @29.50000s +00.00100s
|`->config-lxd ran successfully @29.50100s +00.00000s
|`->config-ubuntu-drivers ran successfully @29.50200s +00.00000s
|`->config-puppet ran successfully @29.50300s +00.00000s
|`->config-chef ran successfully @29.50300s +00.00100s
|`->config-mcollective ran successfully @29.50400s +00.00100s
|`->config-salt-minion ran successfully @29.50500s +00.00100s
|`->config-rightscale_userdata ran successfully @29.50600s +00.00000s
|`->config-scripts-vendor ran successfully @29.50700s +00.00000s
|`->config-scripts-per-once ran successfully @29.50800s +00.00000s
|`->config-scripts-per-boot ran successfully @29.50800s +00.00100s
|`->config-scripts-per-instance ran successfully @29.50900s +00.00000s
|`->config-scripts-user ran successfully @29.51000s +00.00000s
|`->config-ssh-authkey-fingerprints ran successfully @29.51000s +00.05000s
|`->config-keys-to-console ran successfully @29.56000s +00.10700s
|`->config-phone-home ran successfully @29.66700s +00.00100s
|`->config-final-message ran successfully @29.66900s +00.00400s
|`->config-power-state-change ran successfully @29.67300s +00.00100s
Finished stage: (modules-final) 00.19700 seconds

Total Time: 2.86400 seconds

1 boot records analyzed
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- '!' sudo grep Trace '/var/log/cloud-init*'
+ scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR setup_dev_proposed.sh ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com:
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com sudo bash setup_dev_proposed.sh
+ egrep cloud-init
Get:6 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu focal InRelease [18.0 kB]
Get:29 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu focal/main amd64 Packages [656 B]
Get:31 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu focal/main Translation-en [604 B]
Hit:5 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu focal InRelease
  cloud-init
Get:1 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu focal/main amd64 cloud-init all 20.2-45-g5f7825e2-0ubuntu1~20.04.1 [471 kB]
Preparing to unpack .../cloud-init_20.2-45-g5f7825e2-0ubuntu1~20.04.1_all.deb ...
Unpacking cloud-init (20.2-45-g5f7825e2-0ubuntu1~20.04.1) over (20.1-10-g71af48df-0ubuntu5) ...
Setting up cloud-init (20.2-45-g5f7825e2-0ubuntu1~20.04.1) ...
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com sudo hostname something-else
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- sudo cloud-init init
Cloud-init v. 20.2-45-g5f7825e2-0ubuntu1~20.04.1 running 'init' at Thu, 11 Jun 2020 15:22:34 +0000. Up 127.52 seconds.
ci-info: ++++++++++++++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++++++++++++
ci-info: +--------+------+----------------------------+---------------+--------+-------------------+
ci-info: | Device |  Up  |          Address           |      Mask     | Scope  |     Hw-Address    |
ci-info: +--------+------+----------------------------+---------------+--------+-------------------+
ci-info: |  eth0  | True |        10.41.41.73         | 255.255.255.0 | global | 06:67:0e:99:8e:64 |
ci-info: |  eth0  | True | fe80::467:eff:fe99:8e64/64 |       .       |  link  | 06:67:0e:99:8e:64 |
ci-info: |   lo   | True |         127.0.0.1          |   255.0.0.0   |  host  |         .         |
ci-info: |   lo   | True |          ::1/128           |       .       |  host  |         .         |
ci-info: +--------+------+----------------------------+---------------+--------+-------------------+
ci-info: +++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++++
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: | Route | Destination |  Gateway   |     Genmask     | Interface | Flags |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: |   0   |   0.0.0.0   | 10.41.41.1 |     0.0.0.0     |    eth0   |   UG  |
ci-info: |   1   |  10.41.41.0 |  0.0.0.0   |  255.255.255.0  |    eth0   |   U   |
ci-info: |   2   |  10.41.41.1 |  0.0.0.0   | 255.255.255.255 |    eth0   |   UH  |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: | Route | Destination | Gateway | Interface | Flags |
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: |   1   |  fe80::/64  |    ::   |    eth0   |   U   |
ci-info: |   3   |    local    |    ::   |    eth0   |   U   |
ci-info: |   4   |   ff00::/8  |    ::   |    eth0   |   U   |
ci-info: +-------+-------------+---------+-----------+-------+
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- sudo cloud-init clean --logs --reboot
Connection to ec2-3-16-56-170.us-east-2.compute.amazonaws.com closed by remote host.
+ true
+ sleep 60
+ date --utc +%s.%N
1591889021.893343886
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 15:23:29 +0000
detail:
DataSourceEc2Local
+ date --utc +%s.%N
1591889026.617565348
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- hostname
SRU-worked-aws
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- sudo systemd-analyze
Startup finished in 2.027s (kernel) + 15.224s (userspace) = 17.251s 
graphical.target reached after 14.495s in userspace
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- sudo cloud-init analyze show
-- Boot Record 01 --
The total time elapsed since completing an event is printed after the "@" character.
The time the event takes is printed after the "+" character.

Starting stage: init-local
|`->no cache found @00.00500s +00.00000s
|`->found local data from DataSourceEc2Local @00.01200s +00.30700s
Finished stage: (init-local) 00.48900 seconds

Starting stage: init-network
|`->restored from cache with run check: DataSourceEc2Local @02.77800s +00.00300s
|`->setting up datasource @02.83000s +00.00000s
|`->reading and applying user-data @02.83700s +00.00700s
|`->reading and applying vendor-data @02.84400s +00.00000s
|`->activating datasource @02.87300s +00.00100s
|`->config-migrator ran successfully @02.91400s +00.00000s
|`->config-seed_random ran successfully @02.91400s +00.00100s
|`->config-bootcmd ran successfully @02.91500s +00.00000s
|`->config-write-files ran successfully @02.91600s +00.00000s
|`->config-growpart ran successfully @02.91600s +00.12700s
|`->config-resizefs ran successfully @03.04400s +00.11100s
|`->config-disk_setup ran successfully @03.15500s +00.00100s
|`->config-mounts ran successfully @03.15600s +00.00200s
|`->config-set_hostname ran successfully @03.15800s +00.00500s
|`->config-update_hostname ran successfully @03.16300s +00.00200s
|`->config-update_etc_hosts ran successfully @03.16500s +00.00000s
|`->config-ca-certs ran successfully @03.16500s +00.00100s
|`->config-rsyslog ran successfully @03.16600s +00.00100s
|`->config-users-groups ran successfully @03.16700s +00.01700s
|`->config-ssh ran successfully @03.18500s +00.35500s
Finished stage: (init-network) 00.78900 seconds

Starting stage: modules-config
|`->config-emit_upstart ran successfully @08.84900s +00.00000s
|`->config-snap ran successfully @08.84900s +00.00100s
|`->config-ssh-import-id ran successfully @08.85000s +00.82600s
|`->config-locale ran successfully @09.67600s +00.02800s
|`->config-set-passwords ran successfully @09.70400s +00.00100s
|`->config-grub-dpkg ran successfully @09.70500s +00.21100s
|`->config-apt-pipelining ran successfully @09.91600s +00.00100s
|`->config-apt-configure ran successfully @09.91700s +00.19300s
|`->config-ubuntu-advantage ran successfully @10.11000s +00.00100s
|`->config-ntp ran successfully @10.11100s +00.00100s
|`->config-timezone ran successfully @10.11200s +00.00000s
|`->config-disable-ec2-metadata ran successfully @10.11300s +00.00000s
|`->config-runcmd ran successfully @10.11300s +00.00100s
|`->config-byobu ran successfully @10.11400s +00.00000s
Finished stage: (modules-config) 01.28600 seconds

Starting stage: modules-final
|`->config-package-update-upgrade-install ran successfully @10.76900s +00.00000s
|`->config-fan ran successfully @10.77000s +00.00000s
|`->config-landscape ran successfully @10.77000s +00.00100s
|`->config-lxd ran successfully @10.77100s +00.00100s
|`->config-ubuntu-drivers ran successfully @10.77200s +00.00100s
|`->config-puppet ran successfully @10.77300s +00.00000s
|`->config-chef ran successfully @10.77400s +00.00000s
|`->config-mcollective ran successfully @10.77400s +00.00100s
|`->config-salt-minion ran successfully @10.77500s +00.00100s
|`->config-rightscale_userdata ran successfully @10.77600s +00.00100s
|`->config-scripts-vendor ran successfully @10.77700s +00.00000s
|`->config-scripts-per-once ran successfully @10.77800s +00.00000s
|`->config-scripts-per-boot ran successfully @10.77800s +00.00100s
|`->config-scripts-per-instance ran successfully @10.77900s +00.00000s
|`->config-scripts-user ran successfully @10.78000s +00.00000s
|`->config-ssh-authkey-fingerprints ran successfully @10.78000s +00.05600s
|`->config-keys-to-console ran successfully @10.83600s +00.10500s
|`->config-phone-home ran successfully @10.94100s +00.00100s
|`->config-final-message ran successfully @10.94300s +00.00400s
|`->config-power-state-change ran successfully @10.94700s +00.00000s
Finished stage: (modules-final) 00.19900 seconds

Total Time: 2.76300 seconds

1 boot records analyzed
+ '[' focal = xenial ']'
+ echo '--- Expect success on bionic for jinja because deb DOES have jinja dep.'
--- Expect success on bionic for jinja because deb DOES have jinja dep.
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com 'cloud-init query --format '\''cloud-region: {{cloud_name}}-{{region}}'\'''
cloud-region: aws-us-east-2
+ echo 'Get cloud-id'
Get cloud-id
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com cloud-id
aws
+ echo 'Per LP:1863943 we should hide IMDSv2 tokens on the log'
Per LP:1863943 we should hide IMDSv2 tokens on the log
+ perform_imds_hidden_token_verification ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
+ ec2_inst=ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
+ search_file=/var/log/cloud-init.log
+ search_pattern=''\''X-aws-ec2-metadata-token'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token'\'''
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ wc -l
++ grep ''\''X-aws-ec2-metadata-token'\'''
+ num_token_key=67
+ search_pattern=''\''X-aws-ec2-metadata-token'\'': '\''REDACTED'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token'\'':' ''\''REDACTED'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token'\'':'
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token'\'':'
++ wc -l
+ num_token_key_redacted=67
+ '[' 67 = 67 ']'
+ echo 'X-aws-ec2-metadata-token are correctly appearing as redacted in logs'
X-aws-ec2-metadata-token are correctly appearing as redacted in logs
+ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ wc -l
+ num_token_key=1
+ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'': '\''REDACTED'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token-ttl-seconds'\'':' ''\''REDACTED'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'':'
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token-ttl-seconds'\'':'
++ wc -l
+ num_token_key_redacted=1
+ '[' 1 = 1 ']'
+ echo 'X-aws-ec2-metadata-token-ttl-seconds are correctly appearing as redacted in logs'
X-aws-ec2-metadata-token-ttl-seconds are correctly appearing as redacted in logs
+ echo 'Per LP:1876312 should route based on device-number not on mac address'
Per LP:1876312 should route based on device-number not on mac address
+ echo 'Per LP:1866930 should configure other network interfaces from imds data'
Per LP:1866930 should configure other network interfaces from imds data
+ echo 'However LP:1866930 does not apply to Bionic, Eoan and Xenial'
However LP:1866930 does not apply to Bionic, Eoan and Xenial
+ perform_nic_ordering_test ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com focal
+ ec2_inst=ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
+ series=focal
++ get_ec2_instance_id ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ dns_name=ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ run_describe_command ec2-3-16-56-170.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].InstanceId'
++ dnsname=ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-16-56-170.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].InstanceId'
++ jq -r '.[]'
+ instance_id=i-0119f44e4315d8939
++ get_subnet_id ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ inst_name=ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].SubnetId'
++ run_describe_command ec2-3-16-56-170.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].SubnetId'
++ dnsname=ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].SubnetId'
++ jq -r '.[]'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-16-56-170.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].SubnetId'
+ subnet_id=subnet-0afec7d3c136a3ccb
+ echo 'Creating two nic to test feature...'
Creating two nic to test feature...
++ setup_network_interface subnet-0afec7d3c136a3ccb
++ subnet_id=subnet-0afec7d3c136a3ccb
+++ create_network_interface subnet-0afec7d3c136a3ccb
+++ subnet_id=subnet-0afec7d3c136a3ccb
+++ aws ec2 create-network-interface --subnet-id subnet-0afec7d3c136a3ccb
++ network_interface_json='{
    "NetworkInterface": {
        "AvailabilityZone": "us-east-2b",
        "Description": "",
        "Groups": [
            {
                "GroupName": "default",
                "GroupId": "sg-0c3f58efd82634f04"
            }
        ],
        "InterfaceType": "interface",
        "Ipv6Addresses": [],
        "MacAddress": "06:fd:2d:1d:4b:e4",
        "NetworkInterfaceId": "eni-011e6d16022205375",
        "OwnerId": "329688318733",
        "PrivateDnsName": "ip-10-41-41-216.us-east-2.compute.internal",
        "PrivateIpAddress": "10.41.41.216",
        "PrivateIpAddresses": [
            {
                "Primary": true,
                "PrivateDnsName": "ip-10-41-41-216.us-east-2.compute.internal",
                "PrivateIpAddress": "10.41.41.216"
            }
        ],
        "RequesterManaged": false,
        "SourceDestCheck": true,
        "Status": "pending",
        "SubnetId": "subnet-0afec7d3c136a3ccb",
        "TagSet": [],
        "VpcId": "vpc-019733e0f085e012a"
    }
}'
++ get_network_interface_id '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:fd:2d:1d:4b:e4",' '"NetworkInterfaceId":' '"eni-011e6d16022205375",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-216.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.216",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-216.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.216"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
++ network_interface_json='{ "NetworkInterface": { "AvailabilityZone": "us-east-2b", "Description": "", "Groups": [ { "GroupName": "default", "GroupId": "sg-0c3f58efd82634f04" } ], "InterfaceType": "interface", "Ipv6Addresses": [], "MacAddress": "06:fd:2d:1d:4b:e4", "NetworkInterfaceId": "eni-011e6d16022205375", "OwnerId": "329688318733", "PrivateDnsName": "ip-10-41-41-216.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.216", "PrivateIpAddresses": [ { "Primary": true, "PrivateDnsName": "ip-10-41-41-216.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.216" } ], "RequesterManaged": false, "SourceDestCheck": true, "Status": "pending", "SubnetId": "subnet-0afec7d3c136a3ccb", "TagSet": [], "VpcId": "vpc-019733e0f085e012a" } }'
++ jq -r .NetworkInterface.NetworkInterfaceId
++ echo '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:fd:2d:1d:4b:e4",' '"NetworkInterfaceId":' '"eni-011e6d16022205375",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-216.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.216",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-216.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.216"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
+ network_interface_id_1=eni-011e6d16022205375
++ setup_network_interface subnet-0afec7d3c136a3ccb
++ subnet_id=subnet-0afec7d3c136a3ccb
+++ create_network_interface subnet-0afec7d3c136a3ccb
+++ subnet_id=subnet-0afec7d3c136a3ccb
+++ aws ec2 create-network-interface --subnet-id subnet-0afec7d3c136a3ccb
++ network_interface_json='{
    "NetworkInterface": {
        "AvailabilityZone": "us-east-2b",
        "Description": "",
        "Groups": [
            {
                "GroupName": "default",
                "GroupId": "sg-0c3f58efd82634f04"
            }
        ],
        "InterfaceType": "interface",
        "Ipv6Addresses": [],
        "MacAddress": "06:a9:ab:7d:1f:94",
        "NetworkInterfaceId": "eni-03844f2cb1d3f52a2",
        "OwnerId": "329688318733",
        "PrivateDnsName": "ip-10-41-41-233.us-east-2.compute.internal",
        "PrivateIpAddress": "10.41.41.233",
        "PrivateIpAddresses": [
            {
                "Primary": true,
                "PrivateDnsName": "ip-10-41-41-233.us-east-2.compute.internal",
                "PrivateIpAddress": "10.41.41.233"
            }
        ],
        "RequesterManaged": false,
        "SourceDestCheck": true,
        "Status": "pending",
        "SubnetId": "subnet-0afec7d3c136a3ccb",
        "TagSet": [],
        "VpcId": "vpc-019733e0f085e012a"
    }
}'
++ get_network_interface_id '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:a9:ab:7d:1f:94",' '"NetworkInterfaceId":' '"eni-03844f2cb1d3f52a2",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-233.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.233",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-233.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.233"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
++ network_interface_json='{ "NetworkInterface": { "AvailabilityZone": "us-east-2b", "Description": "", "Groups": [ { "GroupName": "default", "GroupId": "sg-0c3f58efd82634f04" } ], "InterfaceType": "interface", "Ipv6Addresses": [], "MacAddress": "06:a9:ab:7d:1f:94", "NetworkInterfaceId": "eni-03844f2cb1d3f52a2", "OwnerId": "329688318733", "PrivateDnsName": "ip-10-41-41-233.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.233", "PrivateIpAddresses": [ { "Primary": true, "PrivateDnsName": "ip-10-41-41-233.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.233" } ], "RequesterManaged": false, "SourceDestCheck": true, "Status": "pending", "SubnetId": "subnet-0afec7d3c136a3ccb", "TagSet": [], "VpcId": "vpc-019733e0f085e012a" } }'
++ jq -r .NetworkInterface.NetworkInterfaceId
++ echo '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:a9:ab:7d:1f:94",' '"NetworkInterfaceId":' '"eni-03844f2cb1d3f52a2",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-233.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.233",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-233.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.233"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
+ network_interface_id_2=eni-03844f2cb1d3f52a2
+ echo 'Attaching network interfaces to instance...'
Attaching network interfaces to instance...
++ attach_network_interface i-0119f44e4315d8939 eni-011e6d16022205375 1
++ instance_id=i-0119f44e4315d8939
++ network_interface_id=eni-011e6d16022205375
++ device_index=1
++ aws ec2 attach-network-interface --device-index 1 --instance-id i-0119f44e4315d8939 --network-interface-id eni-011e6d16022205375
++ jq -r .AttachmentId
+ attachment_id_1=eni-attach-0b281a3b8aa93f11e
++ attach_network_interface i-0119f44e4315d8939 eni-03844f2cb1d3f52a2 2
++ instance_id=i-0119f44e4315d8939
++ network_interface_id=eni-03844f2cb1d3f52a2
++ device_index=2
++ aws ec2 attach-network-interface --device-index 2 --instance-id i-0119f44e4315d8939 --network-interface-id eni-03844f2cb1d3f52a2
++ jq -r .AttachmentId
+ attachment_id_2=eni-attach-07214c2ffe65b625e
+ sleep 60
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- sudo cloud-init init
Cloud-init v. 20.2-45-g5f7825e2-0ubuntu1~20.04.1 running 'init' at Thu, 11 Jun 2020 15:25:37 +0000. Up 144.32 seconds.
ci-info: ++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++
ci-info: +--------+-------+----------------------------+---------------+--------+-------------------+
ci-info: | Device |   Up  |          Address           |      Mask     | Scope  |     Hw-Address    |
ci-info: +--------+-------+----------------------------+---------------+--------+-------------------+
ci-info: |  eth0  |  True |        10.41.41.73         | 255.255.255.0 | global | 06:67:0e:99:8e:64 |
ci-info: |  eth0  |  True | fe80::467:eff:fe99:8e64/64 |       .       |  link  | 06:67:0e:99:8e:64 |
ci-info: |  eth1  | False |             .              |       .       |   .    | 06:fd:2d:1d:4b:e4 |
ci-info: |  eth2  | False |             .              |       .       |   .    | 06:a9:ab:7d:1f:94 |
ci-info: |   lo   |  True |         127.0.0.1          |   255.0.0.0   |  host  |         .         |
ci-info: |   lo   |  True |          ::1/128           |       .       |  host  |         .         |
ci-info: +--------+-------+----------------------------+---------------+--------+-------------------+
ci-info: +++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++++
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: | Route | Destination |  Gateway   |     Genmask     | Interface | Flags |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: |   0   |   0.0.0.0   | 10.41.41.1 |     0.0.0.0     |    eth0   |   UG  |
ci-info: |   1   |  10.41.41.0 |  0.0.0.0   |  255.255.255.0  |    eth0   |   U   |
ci-info: |   2   |  10.41.41.1 |  0.0.0.0   | 255.255.255.255 |    eth0   |   UH  |
ci-info: +-------+-------------+------------+-----------------+-----------+-------+
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: | Route | Destination | Gateway | Interface | Flags |
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: |   1   |  fe80::/64  |    ::   |    eth0   |   U   |
ci-info: |   3   |    local    |    ::   |    eth0   |   U   |
ci-info: |   4   |   ff00::/8  |    ::   |    eth0   |   U   |
ci-info: +-------+-------------+---------+-----------+-------+
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- sudo cloud-init clean --logs --reboot
Connection to ec2-3-16-56-170.us-east-2.compute.amazonaws.com closed by remote host.
+ true
+ sleep 90
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 15:26:49 +0000
detail:
DataSourceEc2Local
+ date --utc +%s.%N
1591889238.366814768
+ net_file=/etc/netplan/50-cloud-init.yaml
+ '[' focal = focal ']'
+ perform_eni_route_verification ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com /etc/netplan/50-cloud-init.yaml
+ ec2_inst=ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
+ net_file=/etc/netplan/50-cloud-init.yaml
+ eni_numbers='0 1 2'
+ for NUMBER in $eni_numbers
+ eth_name=eth0
+++ expr 0 + 1
++ expr 1 '*' 100
+ metric_expected=100
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- cat /etc/netplan/50-cloud-init.yaml
++ grep -A3 -m1 eth0
++ awk NF
++ tail -n1
++ awk '{print $2}'
+ actual_metric=100
+ '[' 100 = 100 ']'
+ echo 'route metric is correct'
route metric is correct
+ for NUMBER in $eni_numbers
+ eth_name=eth1
+++ expr 1 + 1
++ expr 2 '*' 100
+ metric_expected=200
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- cat /etc/netplan/50-cloud-init.yaml
++ tail -n1
++ grep -A3 -m1 eth1
++ awk NF
++ awk '{print $2}'
+ actual_metric=200
+ '[' 200 = 200 ']'
+ echo 'route metric is correct'
route metric is correct
+ for NUMBER in $eni_numbers
+ eth_name=eth2
+++ expr 2 + 1
++ expr 3 '*' 100
+ metric_expected=300
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com -- cat /etc/netplan/50-cloud-init.yaml
++ grep -A3 -m1 eth2
++ awk NF
++ tail -n1
++ awk '{print $2}'
+ actual_metric=300
+ '[' 300 = 300 ']'
+ echo 'route metric is correct'
route metric is correct
+ teardown_network_interface eni-attach-0b281a3b8aa93f11e eni-011e6d16022205375
+ attachment_id=eni-attach-0b281a3b8aa93f11e
+ network_interface_id=eni-011e6d16022205375
+ detach_network_interface eni-attach-0b281a3b8aa93f11e
+ attachment_id=eni-attach-0b281a3b8aa93f11e
+ aws ec2 detach-network-interface --attachment-id eni-attach-0b281a3b8aa93f11e
+ sleep 30
+ delete_network_interface eni-011e6d16022205375
+ network_interface_id=eni-011e6d16022205375
+ aws ec2 delete-network-interface --network-interface-id eni-011e6d16022205375
+ teardown_network_interface eni-attach-07214c2ffe65b625e eni-03844f2cb1d3f52a2
+ attachment_id=eni-attach-07214c2ffe65b625e
+ network_interface_id=eni-03844f2cb1d3f52a2
+ detach_network_interface eni-attach-07214c2ffe65b625e
+ attachment_id=eni-attach-07214c2ffe65b625e
+ aws ec2 detach-network-interface --attachment-id eni-attach-07214c2ffe65b625e
+ sleep 30
+ delete_network_interface eni-03844f2cb1d3f52a2
+ network_interface_id=eni-03844f2cb1d3f52a2
+ aws ec2 delete-network-interface --network-interface-id eni-03844f2cb1d3f52a2
+ echo 'Validating whether metadata is being updated per boot LP:1819913'
Validating whether metadata is being updated per boot LP:1819913
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com 'grep '\''Update datasource'\'' /var/log/cloud-init.log'
2020-06-11 15:26:38,032 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com sudo reboot
+ sleep 60
+ echo 'After reboot'
After reboot
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com 'grep '\''Update datasource'\'' /var/log/cloud-init.log'
2020-06-11 15:26:38,032 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:29:22,208 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
+ terminate_instance ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
+ ec2_inst=ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
+ '[' false = false ']'
+ echo 'deleting instance'
deleting instance
++ get_ec2_instance_id ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ dns_name=ubuntu@ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ run_describe_command ec2-3-16-56-170.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].InstanceId'
++ dnsname=ec2-3-16-56-170.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-16-56-170.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].InstanceId'
++ jq -r '.[]'
+ ec2_inst_id=i-0119f44e4315d8939
+ aws ec2 terminate-instances --instance-ids i-0119f44e4315d8939
{
    "TerminatingInstances": [
        {
            "CurrentState": {
                "Code": 32,
                "Name": "shutting-down"
            },
            "InstanceId": "i-0119f44e4315d8939",
            "PreviousState": {
                "Code": 16,
                "Name": "running"
            }
        }
    ]
}
+ echo '### END focal'
### END focal
+ for series in $SRU_SERIES
+ echo '### BEGIN xenial'
### BEGIN xenial
++ launch-ec2 --series xenial -u sethostname.yaml -t t2.small
++ awk '/Found/{print $5}'
+ EC2_INST=ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
+ '[' -n ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com ']'
+ sleep 60
+ trap 'terminate_instance ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com' ERR
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 15:31:46 +0000
detail:
DataSourceEc2Local
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- cat /run/cloud-init/result.json
{
 "v1": {
  "datasource": "DataSourceEc2Local",
  "errors": []
 }
}
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init.*'
+ echo 'Expect IMDSv2 token headers are being used on all metadata gets. Expect 0 line count'
Expect IMDSv2 token headers are being used on all metadata gets. Expect 0 line count
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- '[[ 0 = `grep headers /var/log/cloud-init.log  | grep -c -v X-aws` ]] || exit 1'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- sudo systemd-analyze
sudo: unable to resolve host SRU-worked-aws
Startup finished in 4.223s (kernel) + 22.732s (userspace) = 26.956s
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- sudo systemd-analyze blame
sudo: unable to resolve host SRU-worked-aws
         12.599s snapd.seeded.service
          3.456s cloud-init-local.service
          3.245s apparmor.service
          2.643s console-setup.service
          2.232s cloud-config.service
          2.034s dev-xvda1.device
          1.065s pollinate.service
          1.056s snapd.service
           902ms cloud-init.service
           861ms networking.service
           558ms cloud-final.service
           520ms lvm2-monitor.service
           505ms iscsid.service
           419ms accounts-daemon.service
           397ms systemd-update-utmp.service
           377ms lxd-containers.service
           371ms resolvconf.service
           302ms systemd-modules-load.service
           299ms ufw.service
           291ms grub-common.service
           283ms sys-kernel-debug.mount
           281ms dev-hugepages.mount
           258ms mdadm.service
           255ms dev-mqueue.mount
           237ms keyboard-setup.service
           187ms kmod-static-nodes.service
           178ms systemd-timesyncd.service
           154ms systemd-logind.service
           153ms apport.service
           149ms systemd-udev-trigger.service
           133ms irqbalance.service
           121ms rsyslog.service
           115ms systemd-remount-fs.service
           111ms ondemand.service
           111ms open-iscsi.service
            89ms systemd-journald.service
            86ms systemd-journal-flush.service
            84ms snapd.socket
            81ms systemd-tmpfiles-setup.service
            77ms systemd-random-seed.service
            72ms polkitd.service
            71ms systemd-user-sessions.service
            63ms systemd-sysctl.service
            62ms systemd-tmpfiles-setup-dev.service
            57ms systemd-udevd.service
            52ms systemd-machine-id-commit.service
            50ms plymouth-read-write.service
            47ms plymouth-quit-wait.service
            46ms plymouth-quit.service
            46ms setvtrgb.service
            43ms lxd.socket
            42ms rc-local.service
            36ms sys-fs-fuse-connections.mount
            36ms snap-core-9289.mount
            28ms snap-amazon\x2dssm\x2dagent-1566.mount
            26ms ssh.service
            21ms user@1000.service
            16ms systemd-update-utmp-runlevel.service
            11ms dev-loop1.device
            11ms dev-loop0.device
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- sudo cloud-init analyze show
sudo: unable to resolve host SRU-worked-aws
-- Boot Record 01 --
The total time elapsed since completing an event is printed after the "@" character.
The time the event takes is printed after the "+" character.

Starting stage: init-local
|`->no cache found @00.02200s +00.00000s
|`->no local data found from DataSourceNoCloud @00.16600s +00.21200s
|`->no local data found from DataSourceConfigDrive @00.37800s +00.20800s
|`->no local data found from DataSourceOpenNebula @00.58600s +00.14000s
|`->no local data found from DataSourceDigitalOcean @00.72600s +00.02000s
Starting stage: init-local/search-Azure
Starting stage: azure-ds/_get_data
|`->Non-Azure DMI asset tag '' discovered. @00.74700s +00.01600s
Finished stage: (azure-ds/_get_data) 00.01600 seconds

Finished stage: (init-local/search-Azure) 00.01700 seconds

|`->no local data found from DataSourceOVF @00.76300s +00.07900s
|`->no local data found from DataSourceOpenStackLocal @00.84200s +00.05000s
|`->no local data found from DataSourceCloudSigma @00.89300s +00.01800s
|`->no local data found from DataSourceSmartOS @00.91100s +00.02800s
|`->no local data found from DataSourceScaleway @00.93900s +00.03200s
|`->found local data from DataSourceEc2Local @00.97100s +00.69300s
Finished stage: (init-local) 01.80900 seconds

Starting stage: init-network
|`->restored from cache with run check: DataSourceEc2Local @03.07600s +00.00300s
|`->setting up datasource @03.14700s +00.00000s
|`->reading and applying user-data @03.15400s +00.00900s
|`->reading and applying vendor-data @03.16300s +00.00000s
|`->activating datasource @03.19200s +00.00200s
|`->config-migrator ran successfully @03.21200s +00.00000s
|`->config-seed_random ran successfully @03.21300s +00.00000s
|`->config-bootcmd ran successfully @03.21400s +00.00000s
|`->config-write-files ran successfully @03.21400s +00.00100s
|`->config-growpart ran successfully @03.21500s +00.04800s
|`->config-resizefs ran successfully @03.26300s +00.02000s
|`->config-disk_setup ran successfully @03.28300s +00.00100s
|`->config-mounts ran successfully @03.28500s +00.00100s
|`->config-set_hostname ran successfully @03.28700s +00.00400s
|`->config-update_hostname ran successfully @03.29200s +00.00100s
|`->config-update_etc_hosts ran successfully @03.29300s +00.00000s
|`->config-ca-certs ran successfully @03.29400s +00.00100s
|`->config-rsyslog ran successfully @03.29500s +00.00100s
|`->config-users-groups ran successfully @03.29600s +00.07000s
|`->config-ssh ran successfully @03.36700s +00.20300s
Finished stage: (init-network) 00.50800 seconds

Starting stage: modules-config
|`->config-emit_upstart ran successfully @17.68800s +00.00000s
|`->config-snap ran successfully @17.68800s +00.00100s
|`->config-ssh-import-id ran successfully @17.68900s +00.66500s
|`->config-locale ran successfully @18.35400s +00.77800s
|`->config-set-passwords ran successfully @19.13300s +00.00100s
|`->config-grub-dpkg ran successfully @19.13400s +00.15700s
|`->config-apt-pipelining ran successfully @19.29200s +00.00100s
|`->config-apt-configure ran successfully @19.29300s +00.20100s
|`->config-ubuntu-advantage ran successfully @19.49400s +00.00100s
|`->config-ntp ran successfully @19.49500s +00.00100s
|`->config-timezone ran successfully @19.49600s +00.00100s
|`->config-disable-ec2-metadata ran successfully @19.49700s +00.00100s
|`->config-runcmd ran successfully @19.49800s +00.00100s
|`->config-byobu ran successfully @19.49900s +00.00100s
Finished stage: (modules-config) 01.83000 seconds

Starting stage: modules-final
|`->config-package-update-upgrade-install ran successfully @19.91500s +00.00100s
|`->config-fan ran successfully @19.91600s +00.00100s
|`->config-landscape ran successfully @19.91700s +00.00100s
|`->config-lxd ran successfully @19.91800s +00.00100s
|`->config-ubuntu-drivers ran successfully @19.91900s +00.00100s
|`->config-puppet ran successfully @19.92000s +00.00100s
|`->config-chef ran successfully @19.92100s +00.00100s
|`->config-mcollective ran successfully @19.92200s +00.00100s
|`->config-salt-minion ran successfully @19.92300s +00.00100s
|`->config-rightscale_userdata ran successfully @19.92400s +00.00100s
|`->config-scripts-vendor ran successfully @19.92500s +00.00100s
|`->config-scripts-per-once ran successfully @19.92600s +00.00100s
|`->config-scripts-per-boot ran successfully @19.92700s +00.00000s
|`->config-scripts-per-instance ran successfully @19.92800s +00.00000s
|`->config-scripts-user ran successfully @19.92900s +00.00000s
|`->config-ssh-authkey-fingerprints ran successfully @19.93000s +00.04400s
|`->config-keys-to-console ran successfully @19.97400s +00.07900s
|`->config-phone-home ran successfully @20.05400s +00.00100s
|`->config-final-message ran successfully @20.05500s +00.00500s
|`->config-power-state-change ran successfully @20.06100s +00.00000s
Finished stage: (modules-final) 00.16700 seconds

Total Time: 4.34700 seconds

1 boot records analyzed
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- '!' sudo grep Trace '/var/log/cloud-init*'
sudo: unable to resolve host SRU-worked-aws
+ scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR setup_dev_proposed.sh ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com:
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com sudo bash setup_dev_proposed.sh
+ egrep cloud-init
Get:6 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu xenial InRelease [18.0 kB]
Get:24 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu xenial/main amd64 Packages [1088 B]
Get:25 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu xenial/main Translation-en [480 B]
  cloud-init
Get:1 http://ppa.launchpad.net/cloud-init-dev/proposed/ubuntu xenial/main amd64 cloud-init all 20.2-45-g5f7825e2-0ubuntu1~16.04.1 [470 kB]
Preparing to unpack .../cloud-init_20.2-45-g5f7825e2-0ubuntu1~16.04.1_all.deb ...
Unpacking cloud-init (20.2-45-g5f7825e2-0ubuntu1~16.04.1) over (19.4-33-gbb4131a2-0ubuntu1~16.04.1) ...
Setting up cloud-init (20.2-45-g5f7825e2-0ubuntu1~16.04.1) ...
Leaving 'diversion of /etc/init/ureadahead.conf to /etc/init/ureadahead.conf.disabled by cloud-init'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com sudo hostname something-else
sudo: unable to resolve host SRU-worked-aws
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- sudo cloud-init init
sudo: unable to resolve host something-else
Cloud-init v. 20.2-45-g5f7825e2-0ubuntu1~16.04.1 running 'init' at Thu, 11 Jun 2020 15:33:27 +0000. Up 128.04 seconds.
ci-info: ++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: | Device |  Up  |           Address           |      Mask     | Scope  |     Hw-Address    |
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: |  eth0  | True |         10.41.41.151        | 255.255.255.0 | global | 06:16:8a:b9:50:a8 |
ci-info: |  eth0  | True | fe80::416:8aff:feb9:50a8/64 |       .       |  link  | 06:16:8a:b9:50:a8 |
ci-info: |   lo   | True |          127.0.0.1          |   255.0.0.0   |  host  |         .         |
ci-info: |   lo   | True |           ::1/128           |       .       |  host  |         .         |
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: ++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++
ci-info: +-------+-------------+------------+---------------+-----------+-------+
ci-info: | Route | Destination |  Gateway   |    Genmask    | Interface | Flags |
ci-info: +-------+-------------+------------+---------------+-----------+-------+
ci-info: |   0   |   0.0.0.0   | 10.41.41.1 |    0.0.0.0    |    eth0   |   UG  |
ci-info: |   1   |  10.41.41.0 |  0.0.0.0   | 255.255.255.0 |    eth0   |   U   |
ci-info: +-------+-------------+------------+---------------+-----------+-------+
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: | Route | Destination | Gateway | Interface | Flags |
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: |   0   |  fe80::/64  |    ::   |    eth0   |   U   |
ci-info: |   4   |   ff00::/8  |    ::   |    eth0   |   U   |
ci-info: +-------+-------------+---------+-----------+-------+
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- sudo cloud-init clean --logs --reboot
sudo: unable to resolve host something-else
Connection to ec2-3-22-224-214.us-east-2.compute.amazonaws.com closed by remote host.
+ true
+ sleep 60
+ date --utc +%s.%N
1591889674.172576311
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 15:34:22 +0000
detail:
DataSourceEc2Local
+ date --utc +%s.%N
1591889677.329267079
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- hostname
SRU-worked-aws
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- sudo systemd-analyze
sudo: unable to resolve host SRU-worked-aws
Startup finished in 4.620s (kernel) + 10.505s (userspace) = 15.126s
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- sudo cloud-init analyze show
sudo: unable to resolve host SRU-worked-aws
-- Boot Record 01 --
The total time elapsed since completing an event is printed after the "@" character.
The time the event takes is printed after the "+" character.

Starting stage: init-local
|`->no cache found @00.01400s +00.00000s
|`->no local data found from DataSourceNoCloud @00.11800s +00.13800s
|`->no local data found from DataSourceConfigDrive @00.25600s +00.15000s
|`->no local data found from DataSourceOpenNebula @00.40600s +00.09300s
|`->no local data found from DataSourceDigitalOcean @00.49900s +00.01900s
Starting stage: init-local/search-Azure
Starting stage: azure-ds/_get_data
|`->Non-Azure DMI asset tag '' discovered. @00.51900s +00.01200s
Finished stage: (azure-ds/_get_data) 00.01200 seconds

Finished stage: (init-local/search-Azure) 00.01300 seconds

|`->no local data found from DataSourceOVF @00.53100s +00.05200s
|`->no local data found from DataSourceOpenStackLocal @00.58300s +00.03800s
|`->no local data found from DataSourceCloudSigma @00.62100s +00.01000s
|`->no local data found from DataSourceSmartOS @00.63200s +00.01400s
|`->no local data found from DataSourceScaleway @00.64600s +00.01000s
|`->found local data from DataSourceEc2Local @00.65700s +00.60700s
Finished stage: (init-local) 01.34500 seconds

Starting stage: init-network
|`->restored from cache with run check: DataSourceEc2Local @01.89800s +00.00300s
|`->setting up datasource @01.96600s +00.00100s
|`->reading and applying user-data @01.97400s +00.00900s
|`->reading and applying vendor-data @01.98300s +00.00000s
|`->activating datasource @02.01200s +00.00200s
|`->config-migrator ran successfully @02.03100s +00.00100s
|`->config-seed_random ran successfully @02.03200s +00.00100s
|`->config-bootcmd ran successfully @02.03300s +00.00000s
|`->config-write-files ran successfully @02.03400s +00.00000s
|`->config-growpart ran successfully @02.03500s +00.04900s
|`->config-resizefs ran successfully @02.08400s +00.01800s
|`->config-disk_setup ran successfully @02.10200s +00.00100s
|`->config-mounts ran successfully @02.10400s +00.00100s
|`->config-set_hostname ran successfully @02.10500s +00.00500s
|`->config-update_hostname ran successfully @02.11000s +00.00200s
|`->config-update_etc_hosts ran successfully @02.11200s +00.00000s
|`->config-ca-certs ran successfully @02.11200s +00.00100s
|`->config-rsyslog ran successfully @02.11300s +00.00100s
|`->config-users-groups ran successfully @02.11400s +00.01500s
|`->config-ssh ran successfully @02.12900s +00.23200s
Finished stage: (init-network) 00.48000 seconds

Starting stage: modules-config
|`->config-emit_upstart ran successfully @05.65600s +00.00100s
|`->config-snap ran successfully @05.65700s +00.00100s
|`->config-ssh-import-id ran successfully @05.65800s +00.69200s
|`->config-locale ran successfully @06.35100s +00.00100s
|`->config-set-passwords ran successfully @06.36500s +00.00100s
|`->config-grub-dpkg ran successfully @06.36600s +00.27700s
|`->config-apt-pipelining ran successfully @06.64500s +00.00100s
|`->config-apt-configure ran successfully @06.64600s +00.16200s
|`->config-ubuntu-advantage ran successfully @06.80900s +00.00000s
|`->config-ntp ran successfully @06.81000s +00.00000s
|`->config-timezone ran successfully @06.81100s +00.00000s
|`->config-disable-ec2-metadata ran successfully @06.81100s +00.00100s
|`->config-runcmd ran successfully @06.81200s +00.00100s
|`->config-byobu ran successfully @06.81300s +00.00100s
Finished stage: (modules-config) 01.17700 seconds

Starting stage: modules-final
|`->config-package-update-upgrade-install ran successfully @07.22900s +00.00100s
|`->config-fan ran successfully @07.23100s +00.00000s
|`->config-landscape ran successfully @07.23200s +00.00000s
|`->config-lxd ran successfully @07.23300s +00.00000s
|`->config-ubuntu-drivers ran successfully @07.23400s +00.00000s
|`->config-puppet ran successfully @07.23400s +00.00100s
|`->config-chef ran successfully @07.23500s +00.00100s
|`->config-mcollective ran successfully @07.23600s +00.00100s
|`->config-salt-minion ran successfully @07.23700s +00.00100s
|`->config-rightscale_userdata ran successfully @07.23800s +00.00100s
|`->config-scripts-vendor ran successfully @07.23900s +00.00100s
|`->config-scripts-per-once ran successfully @07.24000s +00.00100s
|`->config-scripts-per-boot ran successfully @07.24100s +00.00000s
|`->config-scripts-per-instance ran successfully @07.24200s +00.00000s
|`->config-scripts-user ran successfully @07.24300s +00.00000s
|`->config-ssh-authkey-fingerprints ran successfully @07.24400s +00.03900s
|`->config-keys-to-console ran successfully @07.28300s +00.06900s
|`->config-phone-home ran successfully @07.35200s +00.00200s
|`->config-final-message ran successfully @07.35400s +00.00400s
|`->config-power-state-change ran successfully @07.35800s +00.00100s
Finished stage: (modules-final) 00.15200 seconds

Total Time: 3.17900 seconds

1 boot records analyzed
+ '[' xenial = xenial ']'
+ echo '--- Expect warning on xenial for jinja because deb DOES NOT have jinja dep.'
--- Expect warning on xenial for jinja because deb DOES NOT have jinja dep.
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com 'cloud-init query --format '\''cloud-region: {{cloud_name}}-{{region}}'\'''
cloud-region: aws-us-east-2
+ echo 'Get cloud-id'
Get cloud-id
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com cloud-id
aws
+ echo 'Per LP:1863943 we should hide IMDSv2 tokens on the log'
Per LP:1863943 we should hide IMDSv2 tokens on the log
+ perform_imds_hidden_token_verification ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
+ ec2_inst=ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
+ search_file=/var/log/cloud-init.log
+ search_pattern=''\''X-aws-ec2-metadata-token'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token'\'''
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ wc -l
++ grep ''\''X-aws-ec2-metadata-token'\'''
+ num_token_key=67
+ search_pattern=''\''X-aws-ec2-metadata-token'\'': '\''REDACTED'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token'\'':' ''\''REDACTED'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token'\'':'
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token'\'':'
++ wc -l
+ num_token_key_redacted=67
+ '[' 67 = 67 ']'
+ echo 'X-aws-ec2-metadata-token are correctly appearing as redacted in logs'
X-aws-ec2-metadata-token are correctly appearing as redacted in logs
+ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token-ttl-seconds'\'''
++ wc -l
+ num_token_key=1
+ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'': '\''REDACTED'\'''
++ count_occurrences_in_file /var/log/cloud-init.log ''\''X-aws-ec2-metadata-token-ttl-seconds'\'':' ''\''REDACTED'\'''
++ search_file=/var/log/cloud-init.log
++ search_pattern=''\''X-aws-ec2-metadata-token-ttl-seconds'\'':'
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- cat /var/log/cloud-init.log
++ grep ''\''X-aws-ec2-metadata-token-ttl-seconds'\'':'
++ wc -l
+ num_token_key_redacted=1
+ '[' 1 = 1 ']'
+ echo 'X-aws-ec2-metadata-token-ttl-seconds are correctly appearing as redacted in logs'
X-aws-ec2-metadata-token-ttl-seconds are correctly appearing as redacted in logs
+ echo 'Per LP:1876312 should route based on device-number not on mac address'
Per LP:1876312 should route based on device-number not on mac address
+ echo 'Per LP:1866930 should configure other network interfaces from imds data'
Per LP:1866930 should configure other network interfaces from imds data
+ echo 'However LP:1866930 does not apply to Bionic, Eoan and Xenial'
However LP:1866930 does not apply to Bionic, Eoan and Xenial
+ perform_nic_ordering_test ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com xenial
+ ec2_inst=ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
+ series=xenial
++ get_ec2_instance_id ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ dns_name=ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ run_describe_command ec2-3-22-224-214.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].InstanceId'
++ dnsname=ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-22-224-214.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].InstanceId'
++ jq -r '.[]'
+ instance_id=i-071311627fe78a996
++ get_subnet_id ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ inst_name=ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].SubnetId'
++ run_describe_command ec2-3-22-224-214.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].SubnetId'
++ dnsname=ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].SubnetId'
++ jq -r '.[]'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-22-224-214.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].SubnetId'
+ subnet_id=subnet-0afec7d3c136a3ccb
+ echo 'Creating two nic to test feature...'
Creating two nic to test feature...
++ setup_network_interface subnet-0afec7d3c136a3ccb
++ subnet_id=subnet-0afec7d3c136a3ccb
+++ create_network_interface subnet-0afec7d3c136a3ccb
+++ subnet_id=subnet-0afec7d3c136a3ccb
+++ aws ec2 create-network-interface --subnet-id subnet-0afec7d3c136a3ccb
++ network_interface_json='{
    "NetworkInterface": {
        "AvailabilityZone": "us-east-2b",
        "Description": "",
        "Groups": [
            {
                "GroupName": "default",
                "GroupId": "sg-0c3f58efd82634f04"
            }
        ],
        "InterfaceType": "interface",
        "Ipv6Addresses": [],
        "MacAddress": "06:52:38:4e:db:5a",
        "NetworkInterfaceId": "eni-038e5672123346ea8",
        "OwnerId": "329688318733",
        "PrivateDnsName": "ip-10-41-41-163.us-east-2.compute.internal",
        "PrivateIpAddress": "10.41.41.163",
        "PrivateIpAddresses": [
            {
                "Primary": true,
                "PrivateDnsName": "ip-10-41-41-163.us-east-2.compute.internal",
                "PrivateIpAddress": "10.41.41.163"
            }
        ],
        "RequesterManaged": false,
        "SourceDestCheck": true,
        "Status": "pending",
        "SubnetId": "subnet-0afec7d3c136a3ccb",
        "TagSet": [],
        "VpcId": "vpc-019733e0f085e012a"
    }
}'
++ get_network_interface_id '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:52:38:4e:db:5a",' '"NetworkInterfaceId":' '"eni-038e5672123346ea8",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-163.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.163",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-163.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.163"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
++ network_interface_json='{ "NetworkInterface": { "AvailabilityZone": "us-east-2b", "Description": "", "Groups": [ { "GroupName": "default", "GroupId": "sg-0c3f58efd82634f04" } ], "InterfaceType": "interface", "Ipv6Addresses": [], "MacAddress": "06:52:38:4e:db:5a", "NetworkInterfaceId": "eni-038e5672123346ea8", "OwnerId": "329688318733", "PrivateDnsName": "ip-10-41-41-163.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.163", "PrivateIpAddresses": [ { "Primary": true, "PrivateDnsName": "ip-10-41-41-163.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.163" } ], "RequesterManaged": false, "SourceDestCheck": true, "Status": "pending", "SubnetId": "subnet-0afec7d3c136a3ccb", "TagSet": [], "VpcId": "vpc-019733e0f085e012a" } }'
++ jq -r .NetworkInterface.NetworkInterfaceId
++ echo '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:52:38:4e:db:5a",' '"NetworkInterfaceId":' '"eni-038e5672123346ea8",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-163.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.163",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-163.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.163"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
+ network_interface_id_1=eni-038e5672123346ea8
++ setup_network_interface subnet-0afec7d3c136a3ccb
++ subnet_id=subnet-0afec7d3c136a3ccb
+++ create_network_interface subnet-0afec7d3c136a3ccb
+++ subnet_id=subnet-0afec7d3c136a3ccb
+++ aws ec2 create-network-interface --subnet-id subnet-0afec7d3c136a3ccb
++ network_interface_json='{
    "NetworkInterface": {
        "AvailabilityZone": "us-east-2b",
        "Description": "",
        "Groups": [
            {
                "GroupName": "default",
                "GroupId": "sg-0c3f58efd82634f04"
            }
        ],
        "InterfaceType": "interface",
        "Ipv6Addresses": [],
        "MacAddress": "06:e5:4a:c0:72:c0",
        "NetworkInterfaceId": "eni-0debb26068e5d4cc7",
        "OwnerId": "329688318733",
        "PrivateDnsName": "ip-10-41-41-189.us-east-2.compute.internal",
        "PrivateIpAddress": "10.41.41.189",
        "PrivateIpAddresses": [
            {
                "Primary": true,
                "PrivateDnsName": "ip-10-41-41-189.us-east-2.compute.internal",
                "PrivateIpAddress": "10.41.41.189"
            }
        ],
        "RequesterManaged": false,
        "SourceDestCheck": true,
        "Status": "pending",
        "SubnetId": "subnet-0afec7d3c136a3ccb",
        "TagSet": [],
        "VpcId": "vpc-019733e0f085e012a"
    }
}'
++ get_network_interface_id '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:e5:4a:c0:72:c0",' '"NetworkInterfaceId":' '"eni-0debb26068e5d4cc7",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-189.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.189",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-189.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.189"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
++ network_interface_json='{ "NetworkInterface": { "AvailabilityZone": "us-east-2b", "Description": "", "Groups": [ { "GroupName": "default", "GroupId": "sg-0c3f58efd82634f04" } ], "InterfaceType": "interface", "Ipv6Addresses": [], "MacAddress": "06:e5:4a:c0:72:c0", "NetworkInterfaceId": "eni-0debb26068e5d4cc7", "OwnerId": "329688318733", "PrivateDnsName": "ip-10-41-41-189.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.189", "PrivateIpAddresses": [ { "Primary": true, "PrivateDnsName": "ip-10-41-41-189.us-east-2.compute.internal", "PrivateIpAddress": "10.41.41.189" } ], "RequesterManaged": false, "SourceDestCheck": true, "Status": "pending", "SubnetId": "subnet-0afec7d3c136a3ccb", "TagSet": [], "VpcId": "vpc-019733e0f085e012a" } }'
++ jq -r .NetworkInterface.NetworkInterfaceId
++ echo '{' '"NetworkInterface":' '{' '"AvailabilityZone":' '"us-east-2b",' '"Description":' '"",' '"Groups":' '[' '{' '"GroupName":' '"default",' '"GroupId":' '"sg-0c3f58efd82634f04"' '}' '],' '"InterfaceType":' '"interface",' '"Ipv6Addresses":' '[],' '"MacAddress":' '"06:e5:4a:c0:72:c0",' '"NetworkInterfaceId":' '"eni-0debb26068e5d4cc7",' '"OwnerId":' '"329688318733",' '"PrivateDnsName":' '"ip-10-41-41-189.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.189",' '"PrivateIpAddresses":' '[' '{' '"Primary":' true, '"PrivateDnsName":' '"ip-10-41-41-189.us-east-2.compute.internal",' '"PrivateIpAddress":' '"10.41.41.189"' '}' '],' '"RequesterManaged":' false, '"SourceDestCheck":' true, '"Status":' '"pending",' '"SubnetId":' '"subnet-0afec7d3c136a3ccb",' '"TagSet":' '[],' '"VpcId":' '"vpc-019733e0f085e012a"' '}' '}'
+ network_interface_id_2=eni-0debb26068e5d4cc7
+ echo 'Attaching network interfaces to instance...'
Attaching network interfaces to instance...
++ attach_network_interface i-071311627fe78a996 eni-038e5672123346ea8 1
++ instance_id=i-071311627fe78a996
++ network_interface_id=eni-038e5672123346ea8
++ device_index=1
++ aws ec2 attach-network-interface --device-index 1 --instance-id i-071311627fe78a996 --network-interface-id eni-038e5672123346ea8
++ jq -r .AttachmentId
+ attachment_id_1=eni-attach-016426aa4b5f83519
++ attach_network_interface i-071311627fe78a996 eni-0debb26068e5d4cc7 2
++ instance_id=i-071311627fe78a996
++ network_interface_id=eni-0debb26068e5d4cc7
++ device_index=2
++ jq -r .AttachmentId
++ aws ec2 attach-network-interface --device-index 2 --instance-id i-071311627fe78a996 --network-interface-id eni-0debb26068e5d4cc7
+ attachment_id_2=eni-attach-0247b2ba81c57faf4
+ sleep 60
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- sudo cloud-init init
sudo: unable to resolve host SRU-worked-aws
Cloud-init v. 20.2-45-g5f7825e2-0ubuntu1~16.04.1 running 'init' at Thu, 11 Jun 2020 15:36:24 +0000. Up 137.24 seconds.
ci-info: +++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++
ci-info: +--------+-------+-----------------------------+---------------+--------+-------------------+
ci-info: | Device |   Up  |           Address           |      Mask     | Scope  |     Hw-Address    |
ci-info: +--------+-------+-----------------------------+---------------+--------+-------------------+
ci-info: |  eth0  |  True |         10.41.41.151        | 255.255.255.0 | global | 06:16:8a:b9:50:a8 |
ci-info: |  eth0  |  True | fe80::416:8aff:feb9:50a8/64 |       .       |  link  | 06:16:8a:b9:50:a8 |
ci-info: |  eth1  | False |              .              |       .       |   .    | 06:52:38:4e:db:5a |
ci-info: |  eth2  | False |              .              |       .       |   .    | 06:e5:4a:c0:72:c0 |
ci-info: |   lo   |  True |          127.0.0.1          |   255.0.0.0   |  host  |         .         |
ci-info: |   lo   |  True |           ::1/128           |       .       |  host  |         .         |
ci-info: +--------+-------+-----------------------------+---------------+--------+-------------------+
ci-info: ++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++
ci-info: +-------+-------------+------------+---------------+-----------+-------+
ci-info: | Route | Destination |  Gateway   |    Genmask    | Interface | Flags |
ci-info: +-------+-------------+------------+---------------+-----------+-------+
ci-info: |   0   |   0.0.0.0   | 10.41.41.1 |    0.0.0.0    |    eth0   |   UG  |
ci-info: |   1   |  10.41.41.0 |  0.0.0.0   | 255.255.255.0 |    eth0   |   U   |
ci-info: +-------+-------------+------------+---------------+-----------+-------+
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: | Route | Destination | Gateway | Interface | Flags |
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: |   0   |  fe80::/64  |    ::   |    eth0   |   U   |
ci-info: |   4   |   ff00::/8  |    ::   |    eth0   |   U   |
ci-info: +-------+-------------+---------+-----------+-------+
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- '!' grep Trace '/var/log/cloud-init*'
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- sudo cloud-init clean --logs --reboot
sudo: unable to resolve host SRU-worked-aws
Connection to ec2-3-22-224-214.us-east-2.compute.amazonaws.com closed by remote host.
+ true
+ sleep 90
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- cloud-init status --wait --long

status: done
time: Thu, 11 Jun 2020 15:37:38 +0000
detail:
DataSourceEc2Local
+ date --utc +%s.%N
1591889885.111283318
+ net_file=/etc/netplan/50-cloud-init.yaml
+ '[' xenial = focal ']'
+ '[' xenial = xenial ']'
+ net_file=/etc/network/interfaces.d/50-cloud-init.cfg
+ perform_only_eth0_route_verification ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com /etc/network/interfaces.d/50-cloud-init.cfg
+ ec2_inst=ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
+ net_file=/etc/network/interfaces.d/50-cloud-init.cfg
+ metric_count_expected=0
++ count_occurrences_in_file /etc/network/interfaces.d/50-cloud-init.cfg metric
++ search_file=/etc/network/interfaces.d/50-cloud-init.cfg
++ search_pattern=metric
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- cat /etc/network/interfaces.d/50-cloud-init.cfg
++ grep metric
++ wc -l
+ metric_count_actual=0
+ '[' 0 = 0 ']'
+ echo 'No metrics as expected'
No metrics as expected
+ metric_count_expected=2
++ count_occurrences_in_file /etc/network/interfaces.d/50-cloud-init.cfg eth0
++ search_file=/etc/network/interfaces.d/50-cloud-init.cfg
++ search_pattern=eth0
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- cat /etc/network/interfaces.d/50-cloud-init.cfg
++ grep eth0
++ wc -l
+ metric_count_actual=2
+ '[' 2 = 2 ']'
+ echo 'eth0 interface rendered'
eth0 interface rendered
+ metric_count_expected=0
++ count_occurrences_in_file /etc/network/interfaces.d/50-cloud-init.cfg 'eth[12]'
++ search_file=/etc/network/interfaces.d/50-cloud-init.cfg
++ search_pattern='eth[12]'
++ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com -- cat /etc/network/interfaces.d/50-cloud-init.cfg
++ wc -l
++ grep 'eth[12]'
+ metric_count_actual=0
+ '[' 0 = 0 ']'
+ echo 'No eth1 or eth2 interfaces rendered'
No eth1 or eth2 interfaces rendered
+ teardown_network_interface eni-attach-016426aa4b5f83519 eni-038e5672123346ea8
+ attachment_id=eni-attach-016426aa4b5f83519
+ network_interface_id=eni-038e5672123346ea8
+ detach_network_interface eni-attach-016426aa4b5f83519
+ attachment_id=eni-attach-016426aa4b5f83519
+ aws ec2 detach-network-interface --attachment-id eni-attach-016426aa4b5f83519
+ sleep 30
+ delete_network_interface eni-038e5672123346ea8
+ network_interface_id=eni-038e5672123346ea8
+ aws ec2 delete-network-interface --network-interface-id eni-038e5672123346ea8
+ teardown_network_interface eni-attach-0247b2ba81c57faf4 eni-0debb26068e5d4cc7
+ attachment_id=eni-attach-0247b2ba81c57faf4
+ network_interface_id=eni-0debb26068e5d4cc7
+ detach_network_interface eni-attach-0247b2ba81c57faf4
+ attachment_id=eni-attach-0247b2ba81c57faf4
+ aws ec2 detach-network-interface --attachment-id eni-attach-0247b2ba81c57faf4
+ sleep 30
+ delete_network_interface eni-0debb26068e5d4cc7
+ network_interface_id=eni-0debb26068e5d4cc7
+ aws ec2 delete-network-interface --network-interface-id eni-0debb26068e5d4cc7
+ echo 'Validating whether metadata is being updated per boot LP:1819913'
Validating whether metadata is being updated per boot LP:1819913
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com 'grep '\''Update datasource'\'' /var/log/cloud-init.log'
2020-06-11 15:37:30,622 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:30,801 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,025 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,178 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,196 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,206 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,261 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,298 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,326 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,327 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,341 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com sudo reboot
sudo: unable to resolve host SRU-worked-aws
Connection to ec2-3-22-224-214.us-east-2.compute.amazonaws.com closed by remote host.
+ true
+ sleep 60
+ echo 'After reboot'
After reboot
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com 'grep '\''Update datasource'\'' /var/log/cloud-init.log'
2020-06-11 15:37:30,622 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:30,801 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,025 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,178 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,196 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,206 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,261 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,298 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,326 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,327 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:37:31,341 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:05,527 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:05,668 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:05,809 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:05,906 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:05,921 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:05,932 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:05,980 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:06,019 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:06,043 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:06,044 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:06,058 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2020-06-11 15:40:07,301 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: System boot
+ terminate_instance ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
+ ec2_inst=ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
+ '[' false = false ']'
+ echo 'deleting instance'
deleting instance
++ get_ec2_instance_id ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ dns_name=ubuntu@ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ dns_name=ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ run_describe_command ec2-3-22-224-214.us-east-2.compute.amazonaws.com 'Reservations[].Instances[].InstanceId'
++ dnsname=ec2-3-22-224-214.us-east-2.compute.amazonaws.com
++ query='Reservations[].Instances[].InstanceId'
++ aws ec2 describe-instances --filter Name=dns-name,Values=ec2-3-22-224-214.us-east-2.compute.amazonaws.com --query 'Reservations[].Instances[].InstanceId'
++ jq -r '.[]'
+ ec2_inst_id=i-071311627fe78a996
+ aws ec2 terminate-instances --instance-ids i-071311627fe78a996
{
    "TerminatingInstances": [
        {
            "CurrentState": {
                "Code": 32,
                "Name": "shutting-down"
            },
            "InstanceId": "i-071311627fe78a996",
            "PreviousState": {
                "Code": 16,
                "Name": "running"
            }
        }
    ]
}
+ echo '### END xenial'
### END xenial
