audiolize / vagrant-softlayer

This is a Vagrant plugin that adds a SoftLayer provider to Vagrant, allowing Vagrant to control and provision SoftLayer CCI instances.
MIT License
42 stars 15 forks source link

datacenter.name? #42

Closed jfargen closed 9 years ago

jfargen commented 9 years ago

When I am trying to run:

$ vagrant up --provider=softlayer

I receive an error stating: Vagrant returned an exception while calling the SoftLayer API.

Exception class: XMLRPC::FaultException Exception message: Invalid value provided for 'datacenter.name'. A datacenter name or regional groupmust be provided.

I have tried uncommenting the value sl.datacenter = nil in my Vagrantfile, but this provided the same error. I also change the value from nil to dal09 and I also tried DAL09, but that just makes two new errors.

There was an error loading a Vagrantfile. The file being loaded and the error message are shown below. This is usually caused by a syntax error.

Path: Message: undefined local variable or method `dal09' for main:Object

There was an error loading a Vagrantfile. The file being loaded and the error message are shown below. This is usually caused by a syntax error.

Path: Message: uninitialized constant DAL09

emyl commented 9 years ago

Hello,

Please could you post your Vagrantfile?

jfargen commented 9 years ago

$ cat Vagrantfile Vagrant.require_version ">= 1.5.2"

Vagrant.configure(2) do |config|

See http://docs.vagrantup.com/v2/vagrantfile/vagrant_settings.html

config.vagrant.host = :detect

config.vm.define "sl_cci_shortname" do |cci|

See http://docs.vagrantup.com/v2/vagrantfile/index.html

cci.vm.box                        = "ju2wheels/SL_GENERIC"
cci.vm.hostname                   = "sl-vagrant-cci"
#cci.vm.boot_timeout               = 300
#cci.vm.box_check_update           = false
#cci.vm.box_download_checksum      = nil
#cci.vm.box_download_checksum_type = nil
#cci.vm.box_download_client_cert   = nil
#cci.vm.box_download_insecure      = false
#cci.vm.box_url                    = "https://vagrantcloud.com/ju2wheels/SL_GENERIC/version/1/provider/softlayer.box"
#cci.vm.box_version                = ">=0"
#cci.vm.graceful_halt_timeout      = 300
#cci.vm.guest                      = :linux
#cci.vm.usable_port_range          = 2200..2250
#See http://docs.vagrantup.com/v2/vagrantfile/ssh_settings.html
cci.ssh.forward_agent             = true
cci.ssh.forward_x11               = false
#cci.ssh.guest_port                = 22
#cci.ssh.host                      = nil #Normally determined by provider
#cci.ssh.insert_key                = true
#cci.ssh.password                  = nil
#cci.ssh.port                      = 22
#cci.ssh.private_key_path          = [ File.expand_path("~/.ssh/id_rsa") ]
#cci.ssh.pty                       = false #Warning this setting is not recommended and can break things, recommended to create flex image with sudoers fixed for problematic distros
                                           #See https://github.com/audiolize/vagrant-softlayer/issues/11
#cci.ssh.shell                     = "bash -l"
#cci.ssh.username                  = "vagrant"

#Windows specific config options for vagrant-windows plugin
#cci.windows.halt_check_interval   = 1 if Vagrant.has_plugin?("vagrant-windows")
#cci.windows.halt_timeout          = 30 if Vagrant.has_plugin?("vagrant-windows")
cci.windows.set_work_network      = true if Vagrant.has_plugin?("vagrant-windows")
#cci.winrm.guest_port              = 5985 if Vagrant.has_plugin?("vagrant-windows")
#cci.winrm.host                    = "localhost" if Vagrant.has_plugin?("vagrant-windows")
#cci.winrm.max_tries               = 20 if Vagrant.has_plugin?("vagrant-windows")
#cci.winrm.password                = "vagrant" if Vagrant.has_plugin?("vagrant-windows")
#cci.winrm.port                    = 5985 if Vagrant.has_plugin?("vagrant-windows")
#cci.winrm.timeout                 = 1800 if Vagrant.has_plugin?("vagrant-windows")
cci.winrm.username                = "vagrant" if Vagrant.has_plugin?("vagrant-windows")

#See http://docs.vagrantup.com/v2/networking/index.html
#cci.vm.network :forwarded_port, guest: 22, guest_ip: nil, host:2222, host_ip: nil, protocol: "tcp", auto_correct: true

#Always put the private network before the public so it matches SoftLayer (when using VirtualBox or other hypervisor), eth0 is private and eth1 public, they are created in order provided
#cci.vm.network :private_network, type: "dhcp", ip: nil, auto_config: true, virtualbox__intnet: true
#cci.vm.network :private_network, type: "static", ip: "192.168.10.5", auto_config: true, virtualbox__intnet: "internalnetname"
#cci.vm.network :public_network, type: "dhcp", ip: nil, auto_config: true, virtualbox__intnet: false, bridge: "wlan0"
#cci.vm.network :public_network, type: "static", ip: '192.168.1.20', auto_config: true, virtualbox__intnet: false, bridge: "wlan0"

#See http://docs.vagrantup.com/v2/synced-folders/basic_usage.html
#Guest must have NFS, if using VirtualBox there must be a private network with static IP present, may require root privs (it will prompt)
#cci.vm.synced_folder ".", "/vagrant", disabled: false, create: false, group: "root", owner: "root", type: "nfs", nfs_udp: true, nfs_version: 3, mount_options: []
#cci.vm.synced_folder ".", "/vagrant", disabled: false, create: false, group: "root", owner: "root", type: "rsync", rsync__args: ["--verbose", "--archive", "--delete", "-z"], 
#                          rsync__auto: true, rsync__exclude: [ ".vagrant", ".git"], mount_options: []
#cci.vm.synced_folder ".", "/vagrant", disabled: false, create: false, group: "root", owner: "root", type: "smb", smb_host: nil, smb_username: nil, smb_password: nil, mount_options: []

cci.vm.provider :softlayer do |sl, cci_override|
  #Override the default setting only if using this provider
  cci_override.vm.box       = "ju2wheels/SL_CENTOS_6_64"
  cci_override.ssh.username = "root"

  #Note: If you use SL_GENERIC box you must set sl.image_guid or sl.operating_system/sl.dis_capacity, otherwise it is pre-set for you by the box

  sl.api_key                   = ENV["SL_API_KEY"]
  #sl.api_timeout               = 60
  sl.datacenter                = DAL09  #Use first available
  #sl.dedicated                 = false
  #sl.disk_capacity             = { 0 => 25 } # { disk_num => capacity_gb }, disk 1 reserved for swap by SoftLayer dont use
  sl.domain                    = ENV["SL_DOMAIN"]
  #sl.endpoint_url              = SoftLayer::API_PUBLIC_ENDPOINT
  #sl.force_private_ip          = false
  sl.hostname                  = cci.vm.hostname
  #sl.hourly_billing            = true
  #sl.image_guid                = "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE" #Dont use this with sl.operating_system/sl.disk_capacity, they are mutually exclusive
  sl.local_disk                = false
  #sl.manage_dns                = false
  #sl.max_memory                = 1024
  #sl.network_speed             = 10
  #sl.operating_system          = "SL_CENTOS_6_64" #Set in box, here for override or if you used SL_GENERIC, see contrib/vagrant-softlayer-boxes of vagrant-softlayer plugin for box generator
  #sl.post_install              = nil #URL for post install script
  #sl.private_only              = false
  #sl.provision_timeout         = 1200
  #sl.rebuild_timeout           = 1200
  sl.ssh_keys                  = [ "jfargen-air" ]
  #sl.start_cpus                = 1
  #sl.transaction_wait          = true
  #sl.user_data                 = nil
  sl.username                  = ENV["SL_API_USERNAME"] || ENV['USER'] || ENV['USERNAME']   
  #sl.vlan_private              = nil #Automatically generated, override to vlan number string otherwise, see contrib/vagrant-softlayer-vlans tool for list of acceptable vlan values
  #sl.vlan_public               = nil #Automatically generated, override to vlan number string otherwise

  #Join a load balancer, see https://github.com/audiolize/vagrant-softlayer/wiki/Join-load-balancers for more options
  #sl.join_load_balancer vip: "1.1.1.1", port: 443, method: "Round Robin", type: "TCP" do |service|
    #service.destination_port = 443
    #service.health_check = "Ping"
    #service.weight = 2
  #end
end if Vagrant.has_plugin?("SoftLayer")

#cci.vm.provision :file do |fileupload|
#  fileupload.source      = "/tmp/local_example.txt"
#  fileupload.destination = "/tmp/uploaded_vm_example.txt"
#end

#cci.vm.provision :shell do |shellscript|
  #Use the id to override it somewhere else, and preserve_order ensures it gets executed at the point
  #where it was originally defined instead of where it was overriden.
#  shellscript.inline = "/bin/echo -n 'hello_world' > /dev/null", id: "helloworld", preserve_order: true
#end

end end

ju2wheels commented 9 years ago

The value must be a string type:

sl.datacenter = "dal09"

You can use the vagrant-softlayer-vlans tool in the contrib folder to get the acceptable datacenter names.

jfargen commented 9 years ago

That works! Thanks for the pointer Julio!