Merge ~kajiya/+git/next-demo:change-wording into ~kajiya/+git/next-demo:main

Proposed by Chloé Smith
Status: Merged
Merged at revision: 1e5f4d0315978c1e4294bec50eeaae69c23a8749
Proposed branch: ~kajiya/+git/next-demo:change-wording
Merge into: ~kajiya/+git/next-demo:main
Diff against target: 109 lines (+25/-24)
2 files modified
main.sh (+8/-19)
on-instance.sh (+17/-5)
Reviewer Review Type Date Requested Status
Ankush Pathak (community) Approve
Chloé Smith Abstain
Review via email: mp+462268@code.launchpad.net

Commit message

feat: Reword sentences around pro

Also
  * Pinned a slightly older image
  * (Re-)install ubuntu-advantage-tools on startup so it's up to date
    for the demo
  * Dropped all old-school SSH config
  * Added more steps to on-instance.sh

To post a comment you must log in.
Revision history for this message
Chloé Smith (kajiya) :
review: Abstain
Revision history for this message
Chloé Smith (kajiya) :
review: Abstain
Revision history for this message
Ankush Pathak (ankushpathak) wrote :

Two cosmetic inline comments. But otherwise LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/main.sh b/main.sh
2index f1c099f..40d6620 100755
3--- a/main.sh
4+++ b/main.sh
5@@ -2,12 +2,9 @@
6
7 INSTANCE_NAME=focal-$(petname)
8 ZONE="us-central1-a"
9-IMAGE_NAME="ubuntu-2004-focal-v20231213"
10+IMAGE_NAME="ubuntu-2004-focal-v20231130"
11 PROJECT="${1}"
12
13-PUB_KEYNAME=${INSTANCE_NAME}.rsa.pub
14-PRIVATE_KEYNAME=${INSTANCE_NAME}.rsa
15-
16 lets_spin(){
17 local pid=$!
18 local spin='\|/-'
19@@ -39,15 +36,13 @@ wait_instance_connectable() {
20
21 launch_instance(){
22
23- touch ${INSTANCE_NAME}_hosts_file
24- ssh-keygen -t rsa -f ${INSTANCE_NAME}.rsa -C ubuntu -b 2048 -N ""
25-
26- gcloud compute instances create ${INSTANCE_NAME} --machine-type n2d-standard-4 --project ${PROJECT} --image ${IMAGE_NAME} --image-project=ubuntu-os-cloud --zone ${ZONE} --metadata=ssh-keys=${PRIVATE_KEYNAME},startup-script='#! /bin/bash
27+ printf "Launching a new instance...\n"
28+ gcloud compute instances create ${INSTANCE_NAME} --machine-type n2d-standard-4 --project ${PROJECT} --image ${IMAGE_NAME} --image-project=ubuntu-os-cloud --zone ${ZONE} --metadata=startup-script='#! /bin/bash
29 apt update
30- apt -y install mongodb ros-base-python-dev
31- EOF'
32+ apt -y install mongodb ros-base-python-dev ubuntu-advantage-tools
33+ EOF' & lets_spin
34
35- echo "Waiting for instance to launch..."
36+ echo "Waiting for instance to start..."
37
38 wait_instance_connectable & lets_spin
39
40@@ -60,8 +55,7 @@ launch_instance(){
41 done
42 gcloud compute ssh "ubuntu@${INSTANCE_NAME}" --command "cat instance-bashrc >> ~/.bashrc" --project ${PROJECT} --zone ${ZONE}
43 echo "SSH-ing into the instance..."
44-
45- ssh ubuntu@$(gcloud compute instances describe ${INSTANCE_NAME} --zone ${ZONE} --format json | jq -r '.networkInterfaces[] .accessConfigs[].natIP') -i ${PRIVATE_KEYNAME} -o "StrictHostKeyChecking no" -o UserKnownHostsFile=${INSTANCE_NAME}_hosts_file
46+ gcloud compute ssh "ubuntu@${INSTANCE_NAME}" --project "${PROJECT}" --zone "${ZONE}"
47
48 }
49
50@@ -74,12 +68,7 @@ while true; do
51 then
52 cowsay "Thank you!"
53 fi
54-
55- echo "Now running cleanup..."
56- rm -rfv ${PUB_KEYNAME}
57- rm -rfv ${PRIVATE_KEYNAME}
58- rm -rfv ${INSTANCE_NAME}_hosts_file
59-
60+
61 echo "Deleting the instance and starting over again!"
62 gcloud compute instances delete ${INSTANCE_NAME} --project ${PROJECT} --zone ${ZONE} --quiet & lets_spin
63 done
64diff --git a/on-instance.sh b/on-instance.sh
65index 8fdeb28..773fba8 100644
66--- a/on-instance.sh
67+++ b/on-instance.sh
68@@ -4,8 +4,8 @@ set -e
69 clear
70
71 echo "=========================================================="
72-echo "You are on an Ubuntu 20.04 instance in Google Cloud."
73-echo "Why do you need Ubuntu Pro? Type 'pro security-status' and run the command to find out"
74+printf "$ You are on an Ubuntu 20.04 (Focal Fossa) instance in Google Cloud.\n"
75+printf "$ Find out how secure this instance is; type 'pro security-status' and run the command to find out!\n"
76 read -r USER_INPUT
77 while [ "${USER_INPUT}" != "pro security-status" ]; do
78 echo "Ooops! Please try typing that again."
79@@ -20,15 +20,27 @@ read -r
80 TOKEN=$(cat token)
81 sudo pro attach "${TOKEN}"
82 read -r -p "Return to continue."
83+clear
84 echo "=========================================================="
85 echo "Your instance is now a Pro too."
86-echo "Let's look at the esm-apps installed..."
87+echo "Let's look at the packages installed in detail."
88+printf "\$ pro security-status --esm-apps"
89+read -r
90 pro security-status --esm-apps
91+echo "Looks like there are security updates to install..."
92+printf "\$ sudo apt upgrade -y"
93+read -r
94+sudo apt upgrade -y
95+printf "\$ pro security-status --esm-apps"
96+read -r
97+pro security-status --esm-apps
98+echo "=========================================================="
99+echo "The system is now secure!"
100 echo "=========================================================="
101+printf "\n"
102 echo "Go to ubuntu.com/pro to get your free token."
103-read -r -p "Return to continue."
104 echo "=========================================================="
105-read -r -p "Would you like to switch to a bash session?(y/n)[n]" ANSWER
106+read -r -p "Would you like to switch to a bash session on this instance?(y/n)[n]" ANSWER
107 if [ "${ANSWER}" != "y" ];
108 then
109 exit

Subscribers

People subscribed via source and target branches

to all changes: