From eb976894fcd2190b5a8a06faf3f564b05576423f Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Sat, 27 Oct 2018 02:04:36 -0700 Subject: [PATCH] cleanup --- builder/oracle/classic/config.go | 2 -- builder/oracle/classic/pv_config.go | 30 +++++++++---------- .../docs/builders/oracle-classic.html.md | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/builder/oracle/classic/config.go b/builder/oracle/classic/config.go index 59eafa2d4..82bbb4225 100644 --- a/builder/oracle/classic/config.go +++ b/builder/oracle/classic/config.go @@ -84,8 +84,6 @@ func NewConfig(raws ...interface{}) (*Config, error) { c.SnapshotTimeout = 20 * time.Minute } - // if using a persistent volume - // Validate that all required fields are present var errs *packer.MultiError required := map[string]string{ diff --git a/builder/oracle/classic/pv_config.go b/builder/oracle/classic/pv_config.go index 68dd48e61..d7da88922 100644 --- a/builder/oracle/classic/pv_config.go +++ b/builder/oracle/classic/pv_config.go @@ -20,7 +20,7 @@ split -b 100m diskimage.tar.gz segment_ printf "Split diskimage into %s segments\n" $(ls segment_* | wc -l) # Download jq tool -curl -OL https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 +curl -OLs https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 mv jq-linux64 jq chmod u+x jq @@ -29,39 +29,39 @@ chmod u+x jq for i in segment_*; do ./jq -n --arg path "{{.SegmentPath}}/$i" \ --arg etag $(md5sum $i | cut -f1 -d' ') \ - --arg size_bytes $(stat --printf "%s" $i) \ - '{path: $path, etag: $etag, size_bytes: $size_bytes}' + --arg size_bytes $(stat --printf "%s" $i) \ + '{path: $path, etag: $etag, size_bytes: $size_bytes}' done ) | ./jq -s . > manifest.json # Authenticate curl -D auth-headers -s -X GET \ - -H "X-Storage-User: Storage-{{.AccountID}}:{{.Username}}" \ - -H "X-Storage-Pass: {{.Password}}" \ - https://{{.AccountID}}.storage.oraclecloud.com/auth/v1.0 + -H "X-Storage-User: Storage-{{.AccountID}}:{{.Username}}" \ + -H "X-Storage-Pass: {{.Password}}" \ + https://{{.AccountID}}.storage.oraclecloud.com/auth/v1.0 export AUTH_TOKEN=$(awk 'BEGIN {FS=": "; RS="\r\n"}/^X-Auth-Token/{print $2}' auth-headers) export STORAGE_URL=$(awk 'BEGIN {FS=": "; RS="\r\n"}/^X-Storage-Url/{print $2}' auth-headers) # Upload segments for i in segment_*; do - echo "Uploading segment $i" + echo "Uploading segment $i" - curl -s -X PUT -T $i \ - -H "X-Auth-Token: $AUTH_TOKEN" \ - ${STORAGE_URL}/{{.SegmentPath}}/$i; + curl -s -X PUT -T $i \ + -H "X-Auth-Token: $AUTH_TOKEN" ${STORAGE_URL}/{{.SegmentPath}}/$i; done # Create machine image from manifest curl -s -X PUT \ - -H "X-Auth-Token: $AUTH_TOKEN" \ - "${STORAGE_URL}/compute_images/{{.ImageFile}}?multipart-manifest=put" \ - -T ./manifest.json + -H "X-Auth-Token: $AUTH_TOKEN" \ + "${STORAGE_URL}/compute_images/{{.ImageFile}}?multipart-manifest=put" \ + -T ./manifest.json # Get uploaded image description +echo "Details of ${STORAGE_URL}/compute_images/{{.ImageFile}}:" curl -I -X HEAD \ - -H "X-Auth-Token: $AUTH_TOKEN" \ - "${STORAGE_URL}/compute_images/{{.ImageFile}}" + -H "X-Auth-Token: $AUTH_TOKEN" \ + "${STORAGE_URL}/compute_images/{{.ImageFile}}" ` type PVConfig struct { diff --git a/website/source/docs/builders/oracle-classic.html.md b/website/source/docs/builders/oracle-classic.html.md index d1b3ab405..9cc5d90be 100644 --- a/website/source/docs/builders/oracle-classic.html.md +++ b/website/source/docs/builders/oracle-classic.html.md @@ -290,7 +290,7 @@ setting. "source_image_list": "/oracle/public/OL_7.2_UEKR4_x86_64", "persistent_volume_size": 15, "image_name": "Packer_Builder_Test_{{timestamp}}", - "dest_image_list": "Packer_Builder_Test_List" + "dest_image_list": "Packer_Builder_Test_List", "ssh_username": "opc", "shape": "oc3" }