Skip to content

Commit 9be620f

Browse files
committed
Check SWiPE ID
1 parent 3dbbae5 commit 9be620f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

local-hosting/proxmox/ubuntu-cloud.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22
export TERM=xterm-256color
33

4-
apt update
5-
apt install jq curl -y
4+
apt update -qq
5+
apt install jq curl -y -qq
66

77
function header_info() {
88
clear
@@ -26,7 +26,7 @@ GN=$(echo "\033[1;92m")
2626
DGN=$(echo "\033[32m")
2727
CL=$(echo "\033[m")
2828

29-
if whiptail --backtitle "Splunk" --title "Workshop VM" --yesno "This will create a Observability Workshop VM. Proceed?" 10 58; then
29+
if whiptail --backtitle "Splunk" --title "Observability Workshop VM" --yesno "This will create a Observability Workshop VM. Proceed?" 10 58; then
3030
:
3131
else
3232
header_info && echo -e "${RD}User exited script${CL}\n" && exit
@@ -46,6 +46,11 @@ fi
4646
# Call the API and store the response
4747
JSON_RESPONSE=$(curl -s https://swipe.splunk.show/api?id=${SWIPE_ID})
4848

49+
# Check if Workshop ID not found
50+
if [[ "$JSON_RESPONSE" == '{"message":"Workshop ID not found"}' ]]; then
51+
header_info && echo -e "${RD}Workshop ID not found. Exiting script.${CL}\n" && exit
52+
fi
53+
4954
# Parse the JSON response and extract values
5055
REALM=$(echo ${JSON_RESPONSE} | jq -r '.REALM')
5156
RUM_TOKEN=$(echo ${JSON_RESPONSE} | jq -r '.RUM')
@@ -78,7 +83,6 @@ package_reboot_if_required: false
7883
hostname: $HOSTNAME
7984
manage_etc_hosts: true
8085
fqdn: $HOSTNAME
81-
manage_etc_hosts: true
8286
user: $USER
8387
password: $PASSWORD
8488
chpasswd:
@@ -209,7 +213,7 @@ qm create $VMID --name $HOSTNAME --ostype l26 \
209213
--memory 8192 --balloon 0 \
210214
--agent 1 \
211215
--bios ovmf --machine q35 --efidisk0 $STORAGE:0,pre-enrolled-keys=0 \
212-
--cpu host --socket 1 --cores 2 \
216+
--cpu host --socket 1 --cores 4 \
213217
--net0 virtio,bridge=vmbr0 >/dev/null
214218
qm importdisk $VMID jammy-server-cloudimg-amd64.img $STORAGE >/dev/null
215219
qm set $VMID --scsihw virtio-scsi-pci --virtio0 $STORAGE:vm-$VMID-disk-1,discard=on >/dev/null

0 commit comments

Comments
 (0)