some final clean up
This commit is contained in:
parent
ab4f205bf6
commit
7331d6fc7f
|
@ -57,13 +57,6 @@ func (c *PVConfig) Prepare(ctx *interpolate.Context) (errs *packer.MultiError) {
|
|||
fmt.Errorf("`ssh` is the only valid builder communicator type."))
|
||||
}
|
||||
|
||||
/*
|
||||
s.SSHPty = true
|
||||
s.Type = "ssh"
|
||||
s.SSHUsername = username
|
||||
return s.SSHConfigFunc()(state)
|
||||
*/
|
||||
|
||||
if c.BuilderShape == "" {
|
||||
c.BuilderShape = shapeDefault
|
||||
}
|
||||
|
@ -88,6 +81,7 @@ func (c *PVConfig) Prepare(ctx *interpolate.Context) (errs *packer.MultiError) {
|
|||
|
||||
# Split diskimage in to 100mb chunks
|
||||
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
|
||||
|
@ -113,18 +107,17 @@ curl -D auth-headers -s -X GET \
|
|||
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)
|
||||
|
||||
# Create segment directory
|
||||
curl -v -X PUT -H "X-Auth-Token: $AUTH_TOKEN" ${STORAGE_URL}/{{.SegmentPath}}
|
||||
|
||||
# Upload segments
|
||||
for i in segment_*; do
|
||||
curl -v -X PUT -T $i \
|
||||
echo "Uploading segment $i"
|
||||
|
||||
curl -s -X PUT -T $i \
|
||||
-H "X-Auth-Token: $AUTH_TOKEN" \
|
||||
${STORAGE_URL}/{{.SegmentPath}}/$i;
|
||||
done
|
||||
|
||||
# Create machine image from manifest
|
||||
curl -v -X PUT \
|
||||
curl -s -X PUT \
|
||||
-H "X-Auth-Token: $AUTH_TOKEN" \
|
||||
"${STORAGE_URL}/compute_images/{{.ImageFile}}?multipart-manifest=put" \
|
||||
-T ./manifest.json
|
||||
|
|
|
@ -19,17 +19,6 @@ type stepSecurity struct {
|
|||
}
|
||||
|
||||
func (s *stepSecurity) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
/*
|
||||
TODO: if both are ssh this duplicates effort. see if it still works
|
||||
// Don't do anything if we've already created the security list
|
||||
if _, ok := state.GetOk(s.SecRuleName); !ok {
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
if _, ok := state.GetOk(s.SecListName); !ok {
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
*/
|
||||
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
config := state.Get("config").(*Config)
|
||||
runID := state.Get("run_id").(string)
|
||||
|
|
|
@ -79,6 +79,9 @@ func (s *stepUploadImage) Run(_ context.Context, state multistep.StateBag) multi
|
|||
state.Put("error", err)
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
ui.Say("Uploaded image to object storage.")
|
||||
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue