leonidlm / packer-builder-softlayer

A builder plugin for packer.io for a SoftLayer cloud
MIT License
38 stars 32 forks source link

Updated to work with Packer 0.8.6 #20

Closed toyray closed 8 years ago

toyray commented 8 years ago

Used mitchellh/packer commit 3b29fa5 as a reference to update the plugin to work with Packer 0.8.6.

Currently running Go 1.5, not sure if it makes any difference.

toyray commented 8 years ago

Think this fixes #17 as well :grin:

leonidlm commented 8 years ago

@toyray Thank you for your contribution. I will try to go over the changes and post my remarks soon :)

cmluciano commented 8 years ago

Trying to inherit from an image and suppying my key is not working at all

* unknown configuration key: "ssh_private_key_file"
toyray commented 8 years ago

@cmluciano, sorry about that, I didn't test that because we currently work off base OS images instead of inheriting from existing images.

The configuration key ssh_private_key_file should be readable if it's in the builders section of the JSON template because we do use it when provisioning base OS images with our SSH key and then authenticating against that same key.

I had to make some additional changes on top of this PR (see commit b800f89) to add the SSH key to the provisioned instance, but I don't think that should be required for inherited images.

cmluciano commented 8 years ago

@toyray I tried this both by pulling in your 0.8.6 branch and checking out your code too. I still cannot use the ssh_private_key_file.

git log

~/.gocode/src/github.com/picocandy/packer-builder-softlayer ━╾
╙ ∓ git l2
commit b800f89f97b8dd6eb9ebe57aa9fd9f2bbf9bb11a (HEAD -> use-ssh-key-id, origin/use-ssh-key-id)
Author: Roy Tay <roy@picocandy.com>
Date:   Tue Oct 20 16:03:07 2015 +0800

    Specify ssh_key_id in template to provision with SSH Key of that id

commit 6b9172cefc2003c36128d70d1b277f9599122c7c
Author: Roy Tay <roy@picocandy.com>
Date:   Tue Oct 20 15:34:20 2015 +0800

    Updated to work with Packer 0.8.6

Packer file

{
    "builders": [{
    "type": "softlayer",
    "api_key": “mykey”,
    "username": “myusername”,
    "datacenter_name": "sjc03",
    "base_os_code": "UBUNTU_14_64",
    "image_name": “my image name,
    "image_description": "built with new 086 code",
    "image_type": "standard",
    "instance_name": "packer-ubuntu-{{isotime}}",
    "instance_cpu": 2,
    "instance_memory": 4096,
    "instance_network_speed": 10,
    "instance_state_timeout": "25m",
    "ssh_private_key_file": "/Users/myuser/.ssh/mykey”
  }]
}
toyray commented 8 years ago

@cmluciano, thanks for the sample template, I should be able to check it out once I'm back in the office.

toyray commented 8 years ago

@cmluciano, I tried with a template using base_image_id and ssh_private_key_file with this branch and it worked fine.

Do you have more details on where you encountered the error e.g during building of the plugin, or building of the image, so that I can better reproduce the issue?

I had to make one change in main.go @ 8c71d3c3 to build the plugin with the changes for Packer 0.8.6 (at least until this PR is merged into master). I'll need to update again on the exact revision of packer that I was building against, but it should be either the master branch or the v0.8.6 tag. I'm also using Go 1.5 but packer 0.8.6 should work with Go 1.4+.

cmluciano commented 8 years ago

@toyray By this branch do you mean with your PR with the ssh branch that you have? I don't know what I am building differently. I have checked out your PR and also just b800f89 with the package fix. I am using go 1.5.1 and I have tried with both master and the tag 0.8.6, but I still cannot get this to work.

Can you perhaps push a know good branch with all the chances that you have for ssh_key and correct package name to your repo? This is extremely odd.

cmluciano commented 8 years ago

I have also tried to delete this plugin/packer from my gopath and rebuilt.

axltxl commented 8 years ago

This works like a charm on packer 0.8.7, please merge it onto mainline :) :+1:

toyray commented 8 years ago

@cmluciano, you can try the support-tags branch that we're using internally - it has some extra stuff but it's definitely confirmed to build the plugin and work without any further changes.

go get
go build -o packer_directory/packer-builder-softlayer main.go

Two other things I can think of:

If there's any logs that you want to look at, just copy them to a secret gist and tag me, I'll see what I can do :grinning:

cmluciano commented 8 years ago

@toyray I merged these into our fork and created a release here https://github.com/watson-platform/packer-builder-softlayer/releases/tag/0.1.0

cmluciano commented 8 years ago

This works well for me

toyray commented 8 years ago

Thanks for merging this into master, @cmluciano!