Coder Social home page Coder Social logo

softlayer-ruby's People

Contributors

allmightyspiff avatar artsiommusin avatar cmarkle avatar cphrmky avatar easco avatar festivalbobcats avatar greyhoundforty avatar ju2wheels avatar juice10 avatar mbhavya avatar renier avatar slsthompson avatar smcavallo avatar underscorephil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

softlayer-ruby's Issues

Improve Virtual Server Upgrade Orders

The current interface for upgrading the components (such as RAM, the number of computing cores, or the max port speed) on a virtual server require each component to be upgraded separately. If you wish to upgrade more than one component, you will have to wait for each subsequent upgrade to complete before you can perform the next one.

The upgrade ordering information is stored inside of the VirtualServer class (meaning that a VirtualServer is responsible for some aspect of "product ordering" which seems to be an odd responsibility for that class.

Finally the current design is not consistent with the design of Virtual and Bare Metal sever ordering which provides:

  1. A class dedicated for putting together an order
  2. Routines that make it easy to identify what options are available in configuring a order

The intent of this issue would be refactor the Virtual Server Upgrade Ordering so that it is handled by a dedicated VirtualServerUpgradeOrder class. That class should provide:

  1. The ability to upgrade more than one component of a Virtual Server at once
  2. Routines that help people discover what options are valid for a given component
  3. The class should conform to the informal protocol of the other order classes which allows that order to be verified separately from placing the order.

TITLE: The "SoftLayer_Billing_Order_Quote::placeOrder" method fails when try to order a VSI using ruby client

When trying to order a virtual server instance using the ruby client the "SoftLayer_Billing_Order_Quote::verifyOrder" method fails and raises the following exception:

"A hostname is missing from the order."

The exception is raised despite valid parameters are set and it is possible order using the same quote from UI and also using the php client.

To reproduce the problem use below code

require 'rubygems'

require 'softlayer_api'

require 'pp'

SL_API_USERNAME = "set-me"

SL_API_KEY = "set-me"

client = SoftLayer::Client.new(
:username => "#{SL_API_USERNAME}",
:api_key => "#{SL_API_KEY}")

quoteId = 1242802

order_templates = client['SoftLayer_Billing_Order_Quote'].object_with_id(quoteId).getRecalculatedOrderContainer()

order = order_templates['orderContainers'][0]

order['complexType'] = 'SoftLayer_Container_Product_Order_Virtual_Server'
order['quantity'] = 1
order['location'] = '154820'
order['hardware'] = [{'hostname'=> 'server01', 'domain'=> 'example.com'}]

begin
receipt = client['SoftLayer_Billing_Order_Quote'].object_with_id(quoteId).placeOrder(order)
pprint.pprint(receipt)
rescue => error_reason
puts "The order could not be verified #{error_reason}"
end

getObject returning empty strings instead of nil for absent values

I noticed the getObject behavior changed a bit with the XMLRPC calls. Key without values used to return nil but are now returning as empty strings like "". There are a few cases where we had to alter logic to account for this.

Was this an intended change? I know the use of nil always tends to be a hot topic.

Add the concept of a "Default Client" to simplify calls that require a client as a starting point

In Pull Request #19, cbreden suggested:

Since most people will be working with a single softlayer_client, it might be worth building out some class functions to give people some shortcuts when only one client has been instantiated with a single API user/key combo. For example, getting a specific virtual guest could then become:

--- def self.server_with_id(softlayer_client, server_id, options = {})
---   service = softlayer_client["Virtual_Guest"]
+++ def self.server_with_id(server_id, options = {})
+++   service = options.has_key?(:softlayer_client) ? softlayer_client["Virtual_Guest"] : SoftLayer::Client["Virtual_Guest"]

This probably has the highest amount of impact to the current code base, but there will be some major savings from not tracking a "softlayer_client" variable at all times. This is just one way I could see this being implemented too. Opens up the ability to use cleaner code like this later:

SoftLayer::VirtualServer.server_with_id(3556842)   # -> {gets new server instance with id 3556842}

softlayer_api gem OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):

I am using softlayer_api gem but when i called any method like "getOpenTickets" after

creating SoftLayer::Service object i get this exception:

OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):

my code that is executed in dashboard controller is:

def index

begin

account_service = SoftLayer::Service.new("SoftLayer_Account",

                                       :username => "sl221517a1233tyy",

                                       :api_key => 

"25f38a342079c07f4336543a0fccc54ee8755cb92b53cjfhggergd78d0ed4aa1d9961b85hgtet")

account = account_service.getOpenTickets

rescue Exception => exception

puts "Unable to retrieve account information: #{exception}"

end
end

i also require related libraries as well

require 'rubygems'

require 'softlayer_api'

require 'pp'

require 'openssl'

VirtualServer Upgrade Methods Broken

The _item_price_in_category in VirtualServer.rb method calls self.upgrade_items which doesn't seemed to be defined anywhere.

Example code:

require 'softlayer_api'

begin

   client = SoftLayer::Client.new(
      api_key: 'NaN',
      username: 'user'
   )

   servers = SoftLayer::VirtualServer.find_servers(
      client: client,
   )

   servers[0].upgrade_cores!(8)
rescue Exception => exception
  $stderr.puts "An exception occurred while trying to complete the SoftLayer API calls #{exception}"
end

This prints:

An exception occurred while trying to complete the SoftLayer API calls undefined method `upgrade_items' for #<SoftLayer::VirtualServer:0x000000026b44d0>

SoftLayer::ImageTemplate.template_with_global_id method does not return the correct image template

The SoftLayer::ImageTemplate.template_with_global_id should return an image template object with the specified globalID, but the method returns another image template.

e.g.
when we make the following call :
image_template = SoftLayer::ImageTemplate.template_with_global_id("e59000bb-3030-4e38-9249-215524853d9a", client: client)

We got the image template with globalID "29073a7a-2fac-405c-b59f-4de8ad6e4945"

As workaround we need to use the SoftLayer::ImageTemplate.template_with_id method

capture_image for VirtualServer does not work

Here is the sample code that I am using

!/usr/bin/env ruby

require 'softlayer_api'
require 'pp'

softlayer_client = SoftLayer::Client.new()

server = SoftLayer::VirtualServer.server_with_id('5508708', client: softlayer_client)

puts server.inspect

server.capture_image('master_image', true, 'master_image_note')

Here is the output that I see
home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/create.rb:202:in conv2value': Wrong type NilClass. Not allowed! (RuntimeError) from /home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/create.rb:118:inblock in methodCall'
from /home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/create.rb:117:in collect' from /home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/create.rb:117:inmethodCall'
from /home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/client.rb:285:in call2' from /home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/client.rb:267:incall'
from /home/rohits/.rvm/gems/ruby-2.1.1/gems/softlayer_api-2.1.1/lib/softlayer/Service.rb:278:in call_softlayer_api_with_params' from /home/rohits/.rvm/gems/ruby-2.1.1/gems/softlayer_api-2.1.1/lib/softlayer/APIParameterFilter.rb:201:inmethod_missing'
from /home/rohits/.rvm/gems/ruby-2.1.1/gems/softlayer_api-2.1.1/lib/softlayer/VirtualServer.rb:153:in capture_image' from ./create_image2.rb:12:in

'

It does work if I do this

require 'softlayer_api'
require 'pp'

softlayer_client = SoftLayer::Client.new()

virtual_guest_service = SoftLayer::Service.new("SoftLayer_Virtual_Guest")

CAUTION - hardcoding server id here

server = virtual_guest_service.object_with_id("5508708")
block_devices = server.getBlockDevices

puts server.inspect

img1 = server.createArchiveTransaction("master-image",
[{"id" => block_devices[0]['id']}], "master-image")
puts img1.inspect

Network_Service_Resource properties problem

When working on Network_Service_Resource I am unable to include dependentResources and relatedResources as part of the default object mask although these are listed in the documentation. Not sure if this is a bug or just outdated doc.

net_serv = sl_client[:Account].object_mask("mask[id]").getNetworkStorage.map{|net_serv| SoftLayer::NetworkService.new(sl_client, sl_client[:Network_Storage].object_with_id(net_serv['id']).object_mask(SoftLayer::NetworkService.default_object_mask).getServiceResource) }
XMLRPC::FaultException: Property 'dependentResources' not valid for 'SoftLayer_Network_Service_Resource'.
    from /usr/lib/ruby/1.9.1/xmlrpc/client.rb:414:in `call'
    from /var/lib/gems/1.9.1/gems/softlayer_api-3.0.0/lib/softlayer/Service.rb:281:in `call_softlayer_api_with_params'
    from /var/lib/gems/1.9.1/gems/softlayer_api-3.0.0/lib/softlayer/APIParameterFilter.rb:194:in `method_missing'
    from (irb):118:in `block in irb_binding'
    from (irb):118:in `map'
    from (irb):118
    from /usr/bin/irb:12:in `<main>'

I get the same result for dependentResources and relatedResources properties but the rest work ok.

ju2wheels@c474ff4

Network_Firewall_AccessControlList service not respecting new object mask

We are finally getting around to merging our own api wrapper with the 2.x+ gem here so we can start work on the new semantic models, but we're hitting a few bumps.

We've found at least one service that seems to ignore the new object mask string. Here's some test code that isolates this behavior along with the outputs.

## vvvvv Comment in/out gem version along with appropriate object mask

#gem 'softlayer_api', '=1.0.7'
#OBJECT_MASK = { 'id' => '', 'rules' => { 'id' => ''} }

#gem 'softlayer_api', '=2.1.1'
#OBJECT_MASK = "mask[ id, rules [ id ] ]"

## ^^^^^ Comment in/out gem version along with appropriate object mask 

require 'softlayer_api'
require 'pp'

user = "abc" 
api_key  = "xyzxyz"
firewall_id = 2132  # provide a valid firewall ID

service = SoftLayer::Service.new("SoftLayer_Network_Firewall_AccessControlList", :username => user, :api_key => api_key)
result = service.object_mask(OBJECT_MASK).object_with_id(firewall_id).getObject
pp result
with v1.0.7:
{"id"=>2132,
 "rules"=>
  [{"id"=>1273226},
   {"id"=>1273228},
   {"id"=>1273230},
   {"id"=>1273232},
......
with v2.1.1:
{"direction"=>"in", "firewallContextInterfaceId"=>4235, "id"=>2132}

We haven't found any way to get this mask to work.

Enabling easier API wide password management

Hi all, im working on a tool to support internal IBM ITCS104 security requirements for changing our passwords every 90 days and have a need to locate and change passwords within SoftLayer to update them to match the servers.

Opening this for discussion/thoughts as there is a lot of supporting stuff that would be needed.

I plan on adding the actual tool into vagrant-softlayer as a standalone tool since there isnt an existing cli tool one in this project but hope it may serve as a reference for enhancements to the softlayer-python cli.

Changes/Additions needed to enable mass password updates for various types with a select everything and filter down approach:

Account
    sl_dynamic_attr evaultMasterUsers
      - self.service.getEvaultMasterUsers -> AccountPassword
    sl_dynamic_attr users
      - self.service.getUsers -> [ UserCustomer ]
    sl_dynamic_attr networkMessageDeliveryAccounts
      - self.service.getNetworkMessageDeliveryAccounts -> [ NetworkMessageDelivery ]
    sl_dynamic_attr virtual_disk_images
      - self.service.getVirtualDiskImages -> [ VirtualDiskImage ]

AccountPassword
    sl_attr local_props*
    self.find_password_for_network_storage(sl_client, net_storage_obj_filter => nil)
      - SoftLayer_Account::getNetworkStorage -> SoftLayer_Network_Storage::getAccountPassword -> [ NetworkStorage ]
    self.find_webcc_password_for_network_storage(sl_client, net_storage_obj_filter => nil)
      - SoftLayer_Account::getNetworkStorage -> SoftLayer_Network_Storage::getWebccAccount -> [ NetworkStorage ]
    def password=(password)
      - self.service.editObject password

BareMetalServer
    sl_dynamic_attr softwareComponents
      - self.service.getSoftwareComponents -> [ SoftwareComponent ]
    sl_dynamic_attr remoteManagementAccounts
      - self.service.getRemoteManageAccounts -> [ Hash ]

NetworkMessageDelivery
    sl_attr local_props*
    def password=(password)
      - self.service.editObject password

NetworkServiceResource
    sl_attr local_props*
    - Is apiPassword in this editable?

NetworkStorage
    sl_attr local_props*
    sl_dynamic_attr accountPassword
       - self.service.getAccountPassword -> AccountPassword
       - whats the difference between NetworkStorage.password and NetworkStorage.accountPassword other than type?
    sl_dynamic_attr credentials
       - self.service.getCredentials -> [ NetworkStorageCredential ]
    sl_dynamic_attr serviceResource
       - self.service.getServiceResource -> [ NetworkServiceResource ]
    sl_dynamic_attr webccAccount
       - self.service.getWebccAccount -> AccountPassword
    def password=(password)
       - This one updates self.password using self.service.editObject, not the credential
    def update_credential_password(username, password)
       - self.service.editCredential(username,password)

NetworkStorageCredential
    sl_attr local_props*
    self.find_network_storage_credentials(sl_client, :network_storage_obj_filter => nil)
       - SoftLayer_Account::getNetworkStorage -> SoftLayer_Network_Storage::getCredentials -> [ NetworkStorageCredential ]

Server
    sl_dynamic_attr softwareComponents
      - self.service.getSoftwareComponents -> [ SoftwareComponent ]

SoftwareComponent
    sl_attr local_props*
    self.find_software_on_servers(sl_client, :hw_obj_filter => nil, software_comp_obj_filter => nil)
       - SoftLayer_Account::getHardware -> SoftLayer_Hardware::getSoftwareComponents -> [ SoftwareComponent ]
    self.find_software_on_network_hardware(sl_client, :hw_obj_filter => nil, software_comp_obj_filter => nil)
       - SoftLayer_Account::getNetworkHardware -> SoftLayer_Hardware::getSoftwareComponents -> [ SoftwareComponent ]
    self.find_software_on_virtual_guests(sl_client, :vguest_obj_filter => nil, software_comp_obj_filter => nil)
       - SoftLayer_Account::getVirtualGuests -> SoftLayer_Virtual_Guest::getSoftwareComponents -> [ SoftwareComponent ]
    sl_dynamic_attr passwords
       - self.service.getPasswords -> [ SoftwareComponentPassword ]
    def has_user_password?(user)
       - self.passwords.map{|pw| pw.username}.include?(user)

SoftLayerSoftwareComponentPassword
    sl_attr local_props*
    self.find_password_for_applicationDeliveryControllers(sl_client, :app_dev_cont_obj_filter=>@@app_dev_cont_obj_filter)
      - SoftLayer_Account::getApplicationDeliveryControllers -> SoftLayer_Network_Application_Delivery_Controller::getPassword -> [ SoftwareComponentPassword ]
      - Use object filter to allow filtering app dev controller by dc or other properties
      - as with nw fw cred, if this is returned by one of network hardware SoftwareComponent then we just need to filter that instead
    self.find_password_for_networkVLANFirewallCredentials(sl_client, :hw_fw_obj_filter=>nil, :net_vlan_obj_filter=>nil)
      - SoftLayer_Account::getNetworkHardware -> SoftLayer_Hardware::getNetworkVlans -> SoftLayer_Network_Vlan::getNetworkVlanFirewall -> SoftLayer_Network_Vlan_Firewall::getManagementCredentials -> [ SoftwareComponentPassword ]
      - Use object filters to filter by dc/fqdn of hw_firewall and vlan fqdn
      - may need to filter on dedicatedFirewallFlag in Network_Vlan or filter the hardware by function and get fw hw only to avoid dup entries?
      - not clear if this one is even necessary or correct, it may be part of the SoftwareComponent pw's returned by SoftwareComponent.software_on_network_hardware and we just have to filter that instead
    def password=(password)
      - self.service.editObject password
    @@app_dev_cont_object_filter = advancedModeFlag == true

UserCustomer
    sl_attr local_props*
    sl_dynamic_attr externalBindings
      - self.service.getExternalBindings -> [ UserCustomerExternalBinding ]

UserCustomerExternalBinding
    sl_attr local_props*
    def password=(password)
      - self.service.editObject password #This does not exist, is it read only? SoftLayer_User_Customer only has add/remove binding but expects external binding object (is that hash?)...
      - If this is read only probably will not add this or UserCustomer at all

VirtualDiskImage
    sl_attr local_props*
    sl_dynamic_attr softwareReferences
      - self.service.getSoftwareReferences -> [ VirtualDiskImageSoftware ]

VirtualDiskImageSoftware
    sl_attr local_props*
    slattr passwords
      - self.passwords
    sl_attr diskImage
      - self.diskImage
    has_user_password?(user)
      - self.passwords.map{|pw| pw.username}.include?(user)
    def update_user_password(username, password)
      - softlayer_service[:VirtualDiskImage].object_with_id(diskImage.id).editObject self.id, username, password

Tentative example CLI interface the above would support:

sl pw-man user <portal|forum|vpn> <username> <password>
sl pw-man user reset <username> <password> <newPassword> [<securityQuestionId|securityQuestionString> <securityQuestionAnswer>]
sl pw-man user lost <username> <useremail>
sl pw-man user update_lost <username> <key> <password> [<securityAnswers>]
sl pw-man user list-sec-quest <username>
sl pw-man user list-lost-sec-quest <username> <key>
sl pw-man user set-sec-quest <?>
  • sl pw-man software [--add-user] [sw_filter] [server_filter] [username] password

if no user provided set for all present

--add-user: Adds user if it does not exist, skips pw update otherswise if user
provided and not found

server_filter:
--servers_only
--virtual_guest_only
--network_hardware_only
--dc DCNAME,...
--hostname HOSTNAME,...
--domain DOMAIN,...

sw_filter: #Filter on properties of SoftLayer_Software_Description::getAllObjects
--software-id id,...
--software-description descr
--software-name name,...

  • sl pw-man software --list #id,longDescription,name,requiredUser of SoftLayer_Software_Description
  • sl pw-man net-app-dev-controller [net_app_dev_cont_filter] password

net_app_dev_cont_filter:
--net-app-dev-cont-id id,...
--net-app-dev-cont-name name,...

  • sl pw-man net-vlan-fw-cred [hw_fw_filter] [net_vlan_filter] password
    hw_fw_filter:
    --fw-dc DCNAME,...
    --fw-hostname HOSTNAME,...
    --fw-domain DOMAIN,...

net_vlan_filter:
unknown what to filter on if its even necessary

  • sl pw-man net-vlan-fw-cred --list #hw_fw id,domain,hostname, vlan_fw cred
    sl pw-man remote-user [--add-user] [hw_server_filter] username password
    hw_server_filter:
    --dc DCNAME,...
    --hostname HOSTNAME,...
    --domain DOMAIN,...
  • sl pw-man network-message-delivery username password
  • sl pw-man network-storage [server_filter] [net_storage_filter] password
  • sl pw-man network-storage-cred [server_filter] [net_storage_filter] username password

The "SoftLayer_Billing_Order_Quote::verifyOrder" method fails when try to order a VSI with ruby client

When trying to order a virtual server instance using the ruby client the "SoftLayer_Billing_Order_Quote::verifyOrder" method fails and raises the following exception:

"An invalid price was submitted with this order"

The exception is raised despite valid parameters are set and it is possible order using the same quote from UI and also using the php client.

To reproduce the problem use below code

require 'rubygems'

require 'softlayer_api'

require 'pp'

SL_API_USERNAME = "set-me"

SL_API_KEY = "set-me"

client = SoftLayer::Client.new(
:username => "#{SL_API_USERNAME}",
:api_key => "#{SL_API_KEY}")

quoteId = 1242802

order_templates = client['SoftLayer_Billing_Order_Quote'].object_with_id(quoteId).getRecalculatedOrderContainer()

order = order_templates['orderContainers'][0]

order['complexType'] = 'SoftLayer_Container_Product_Order_Virtual_Server'
order['quantity'] = 1
order['location'] = '154820'
order['hardware'] = [{'hostname'=> 'server01', 'domain'=> 'example.com'}]

begin
receipt = client['SoftLayer_Billing_Order_Quote'].object_with_id(quoteId).verifyOrder(order)
pprint.pprint(receipt)
rescue => error_reason
puts "The order could not be verified #{error_reason}"
end

[bug] ObjectMaskParser has undefined variable propertyName

==> tempvagrantbuildparallel1: An error occurred. The error will be shown after all tasks complete.
An error occurred while executing multiple actions in parallel.
Any errors that occurred are shown below.

An error occurred while executing the action on the 'tempvagrantbuildparallel1'
machine. Please handle this error then try again:

Vagrant returned an exception while calling the SoftLayer API.

Exception class: VagrantPlugins::SoftLayer::Errors::SLApiError
Exception message: Vagrant returned an exception while calling the SoftLayer API.

Exception class: NameError
Exception message: undefined local variable or method `propertyName' for #<SoftLayer::ObjectMaskParser:0x00000003f7fd20>

An error occurred while executing the action on the 'tempvagrantbuildparallel'
machine. Please handle this error then try again:

Vagrant returned an exception while calling the SoftLayer API.

Exception class: VagrantPlugins::SoftLayer::Errors::SLApiError
Exception message: Vagrant returned an exception while calling the SoftLayer API.

Exception class: NameError
Exception message: undefined local variable or method `propertyName' for #<SoftLayer::ObjectMaskParser:0x000000034e10d0>

if property && (property.name != "mask" && propertyName != "filterMask")

Product Package Database Category Item Descriptions Too Vague

When looking at item selections, the descriptions should be as unique as possible so as to clearly differentiate them. Most of the items look fine except for the ones returned by database as shown below.

Running:

sl_client = SoftLayer::Client.new(:api_key => ENV["SL_API_KEY"], :username => ENV["SL_API_USERNAME"])
vs_pkg = SoftLayer::ProductPackage.virtual_server_package(sl_client)
vs_pkg.categories.each{|item_cat| next unless item_cat.categoryCode == 'database'; puts item_cat.categoryCode; item_cat.configuration_options.each {|cat_opt| puts "\t#{cat_opt['price_id']} #{cat_opt['description']}: #{cat_opt['capacity']} #{cat_opt['units']}"} }

Gives this:

database
    40258 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    39738 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    40590 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40462 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40458 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40472 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40490 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40492 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40256 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40260 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40510 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40512 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40530 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40532 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40550 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40552 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40576 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40574 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40270 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40592 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40440 Microsoft SQL Server 2014 Express Edition: 0 N/A
    40600 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40290 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40288 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40610 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40308 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40310 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40620 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40330 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40332 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40630 Microsoft SQL Server 2014 Standard Edition: 0 N/A
    40356 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40354 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40376 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40374 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40392 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40390 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40410 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40420 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    40430 Microsoft SQL Server 2014 Enterprise Edition: 0 N/A
    27998 Riak Enterprise 1.3.0: 0 N/A
    27223 Riak 1.x: 0 N/A
    34960 MySQL for Linux:  
    36492 MySQL 5.7 for Windows: 0 
    36588 MySQL 5.0.51 for Windows: 0 N/A
    34923 MySQL 5.0 for Windows:  
    31648 MongoDB: 0 N/A
    23172 Microsoft SQL Server 2005 Express:  
    32367 Microsoft SQL Server 2005 Workgroup:  
    25297 Microsoft SQL Server 2005 Standard:  
    23079 Microsoft SQL Server 2005 Enterprise:  
    29504 Microsoft SQL Server 2008 Express:  
    33972 Microsoft SQL Server 2008 Web:  
    25417 Microsoft SQL Server 2008 Workgroup:  
    34065 Microsoft SQL Server 2008 Standard:  
    27150 Microsoft SQL Server 2008 Enterprise:  
    32718 Microsoft SQL Server 2008 Express R2:  
    31972 Microsoft SQL Server 2008 Web R2:  
    25600 Microsoft SQL Server 2008 Workgroup R2:  
    22515 Microsoft SQL Server 2008 Standard R2:  
    30560 Microsoft SQL Server 2008 Enterprise R2:  
    26800 Microsoft SQL Server 2012 Express Edition: 0 N/A
    30389 Microsoft SQL Server 2012 Web Edition: 0 N/A
    26337 Microsoft SQL Server 2012 Web Edition: 0 N/A
    26913 Microsoft SQL Server 2012 Web Edition: 0 N/A
    23557 Microsoft SQL Server 2012 Web Edition: 0 N/A
    33287 Microsoft SQL Server 2012 Web Edition: 0 N/A
    27436 Microsoft SQL Server 2012 Web Edition: 0 N/A
    28622 Microsoft SQL Server 2012 Web Edition: 0 N/A
    33101 Microsoft SQL Server 2012 Web Edition: 0 N/A
    33671 Microsoft SQL Server 2012 Web Edition: 0 N/A
    24891 Microsoft SQL Server 2012 Web Edition: 0 N/A
    31979 Microsoft SQL Server 2012 Web Edition: 0 N/A
    24309 Microsoft SQL Server 2012 Web Edition: 0 N/A
    32888 Microsoft SQL Server 2012 Web Edition: 0 N/A
    31131 Microsoft SQL Server 2012 Web Edition: 0 N/A
    27600 Microsoft SQL Server 2012 Web Edition: 0 N/A
    39818 Microsoft SQL Server 2012 Web Edition: 0 N/A
    33061 Microsoft SQL Server 2012 Web Edition: 0 N/A
    32312 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    28705 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    25816 Microsoft SQL Server 2012 Web Edition: 0 N/A
    32962 Microsoft SQL Server 2012 Web Edition: 0 N/A
    31420 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    34146 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    29826 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    23981 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    30054 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    26699 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    25337 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    24095 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    34425 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    30776 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    34592 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    23658 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    29441 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    22574 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    26076 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    30096 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    39798 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    31990 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    24810 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    28175 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    31655 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    26100 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32831 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    31680 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    30856 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    34652 Microsoft SQL Server 2012 Standard Edition: 0 N/A
    29431 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32114 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    24504 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32487 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32822 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    30404 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    28079 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32135 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A
    32990 Microsoft SQL Server 2012 Enterprise Edition: 0 N/A

Whats the difference beyond potentially pricing? Is it arch/seat count/etc... Choosing the right id is useless here unless we know what we are ordering ;-) .

Create semantic interface for Constants

This one may be a bit more abstract. It might be worth having a utility class that can help enumerate many of SoftLayer's constants. Operating system types (plus dynamic handling of the magic strings like *_LATEST), routing types, etc.

On a case-by-case basis, some of these will go into the other objects. But there might be a few stragglers that have no clear home.

Criteria based search routines do not apply filters properly

Calling find_servers in either SoftLayer::BareMetalServer or SoftLayer::VirtualServer with more than one criteria provided will not yield the proper results. For example:

SoftLayer::VirtualServer.find_servers(:domain => 'softlayer.com', :cpus => 4)

Will return the servers in the domain 'softlayer.com', but the criteria limiting the results to 4 cpus will be ignored.

This is because the object filters for those routines are not being put together properly.

[new feature] VirtualServerOrder_Package analog to BareMetalServerOrder_Package

Im currently looking at how we can expand vagrant-softlayer server creation to support all 4 server types:

  • Bare Metal Server
  • Bare Metal Server Instance
  • Virtual Server (simplified with createObject)
  • Virtual Server (advanced created with the old school template and full support for default options one sees on the CCI purchase page today).

Having a VirtualServerOrder_Package analog would allow us to easily provide all four, otherwise it would be a fair amount of work to do the advanced virtual server order.

Error in upgrading from 1.0.8 to 2.2.0

I was using 1.0.8 gem for my rails app, however I found that API calls are breaking after upgrade from 1.0.8 to 2.2.0 gem.

My existing codes look like below :

@softlayer_product_package = SoftLayer::Service.new("SoftLayer_Product_Package",

  •                                                         username:  @sl_user_name,
    
  •                                                         api_key:   @sl_api_key)
    
    package = @softlayer_product_package.object_with_id 46
    available_disks = package.getAvailableStorageUnits
    all_categories = package.object_mask("itemCategory","isRequired").getConfiguration
    item_prices = package.object_mask("id", "item.description", "categories.id", "isRequired").getItemPrices

In order to accommodate 2.2.0, I have updated codes to

@client |= SoftLayer::Client.new(
username: @sl_user_name, # enter your username here
api_key: @sl_api_key # enter your api key here
)
package = SoftLayer::ProductPackage.virtual_server_package(@client)
available_disks = package.getAvailableStorageUnits
all_categories = package.object_mask("itemCategory","isRequired").getConfiguration
item_prices = package.object_mask("id", "item.description", "categories.id", "isRequired").getItemPrices

but I got errors like below :

NoMethodError: undefined method `getAvailableStorageUnits' for #SoftLayer::ProductPackage:0x007fe4d497fdb8

NoMethodError: undefined method `object_mask' for #SoftLayer::ProductPackage:0x007fe4d4b77e40

Can you provide some examples on how I can upgrade my rails app to accommodate 2.2.0 here ?

Allow method_missing "call through" to the Service backing a model object

In issue #19, cbreden suggested:

Since you enforce non-empty ids, you can modify method_missing to redirect to the object's associated service + object id with something like:

service.object_with_id(id).send(method_name,*args,&block) 

This can be secondary after the has_sl_property? check. Allows for both shortening many method implementations as well as letting developers easily call unwrapped API functions.

SoftLayer::Server.cancel! becomes:

def cancel!
  ---  self.service.object_with_id(self.id).deleteObject()
  +++  deleteObject
end

Also allows for inline API calls. For example, these could be used interchangeably -- one invokes the library, one invokes the API directly:

Client.virtual_servers().first.cancel!
Client.virtual_servers().first.deleteObject

**Note that naming conventions sometimes make this actually pretty easy to distinguish. The direct softlayer API calls use lowerCamelCase, where-as the ruby library calls use underscore_notation.

Retrieve "Assigned" Open Tickets via getOpenTickets Call

Is there a way to retrieve all open tickets but include any tickets assigned to a Softlayer employee in that call? These assigned tickets show up in the Softlayer website portal as open/unresolved tickets but they are technically "assigned" so they aren't returned in the getOpenTickets call. Anyone using the getOpenTickets call is probably going to need to get the assigned ones also, or at the very least the hash should be modified so we can pick out which ones we want, like this:

"status"=>{"name"=>"Open", "id"=>1001}

"status"=>{"name"=>"Assigned", "id"=>1002} <= I think 1002 is the code

The status is inconsistent overall, if you do a getTickets call instead of getOpenTickets you don't even get the "status" returned, but instead you get a "statusId." There should be some consistency between these two calls.

[Build System] Provisioning ssh keys to Windows based systems at build

Hi, im dropping this here in the hopes of bypass a resounding "nope, nope, nope" that I would expect to get from SL support without consideration for the technical merit and benefits to end users. If possible can you please pose this question to the relevant devs on your end.

We are working on enabling vagrant-softlayer post_install scripts to provide cygwin sshd with Windows builds for connectivity post build. One of the drawbacks to doing this is the ssh keys selected at order time are ignored for Windows based systems. If we had these provisioned to say C:\ssh_keys\ for us before post_install it would help us provide a more streamlined configuration than having to tell people you have to script a way to download them onto your box, as opposed to we pre dropped them onto the box for you, do what you want with it if you need it.

I have no idea what OS your build system runs on internally but from watching the process I can see its able mount ISOs so if its Linux based one could develop an additional step based on using genisoimage to create an ISO of the selected SSH keys and copy them to the system.

Allow Ruby applications to create 'sys_admin' tickets

The SoftLayer::Ticket class includes "create_standard_ticket" which allows applications to create standard support tickets. This class should have a companion method for creating "sys admin" tickets.

This need was identified as part of the commentary on Issue #26

Allow more direct access to the hashes that are used to implement Model Objects

In issue #19, cbreden suggested:

Redirect open-ended hash calls to a instantiated object to the associated object mask via

def
@sl_hash[key]
end
This allows for something like:

Client.virtual_servers().first['hostname'] # -> "instance_hostname"

...Along with what you currently allow via method_missing:

Client.virtual_servers().first.hostname # -> "instance_hostname"

Bare Metal place order does not work

I am trying to order a bare metal server with package id 51 in london data center

First I take all the defaults

D, [2014-09-16T12:15:38.798833 #3168] DEBUG -- esxi: Configuration with default options:
D, [2014-09-16T12:15:38.798833 #3168] DEBUG -- esxi: server no default
D, [2014-09-16T12:15:38.798833 #3168] DEBUG -- esxi: os CentOS 6.x (64 bit) 25663
D, [2014-09-16T12:15:38.798833 #3168] DEBUG -- esxi: ram 4 GB DDR3 Registered 1333 23132
D, [2014-09-16T12:15:38.798833 #3168] DEBUG -- esxi: disk_controller Non-RAID 32927
D, [2014-09-16T12:15:38.798833 #3168] DEBUG -- esxi: disk0 500GB SATA II 27537
D, [2014-09-16T12:15:38.798833 #3168] DEBUG -- esxi: bandwidth 20000 GB Bandwidth 33867
D, [2014-09-16T12:15:38.798833 #3168] DEBUG -- esxi: port_speed 100 Mbps Public & Private Network Uplinks 26737
D, [2014-09-16T12:15:38.798833 #3168] DEBUG -- esxi: remote_management Reboot / KVM over IP 25014
D, [2014-09-16T12:15:38.798833 #3168] DEBUG -- esxi: pri_ip_addresses 1 IP Address 34807
D, [2014-09-16T12:15:38.799833 #3168] DEBUG -- esxi: monitoring Host Ping 27023
D, [2014-09-16T12:15:38.799833 #3168] DEBUG -- esxi: notification Email and Ticket 32500
D, [2014-09-16T12:15:38.799833 #3168] DEBUG -- esxi: response Automated Notification 32627
D, [2014-09-16T12:15:38.799833 #3168] DEBUG -- esxi: vpn_management Unlimited SSL VPN Users & 1 PPTP VPN User per account 33483
D, [2014-09-16T12:15:38.799833 #3168] DEBUG -- esxi: vulnerability_scanner Nessus Vulnerability Assessment & Reporting 35310

Then I add

server price_id 28103 Single Processor Quad Core Xeon 3450 - 2.66GHz (Lynnfield) - 1 x 8MB cache w/HT
ram 30436 24 GB DDR3 Registered 1333
bandwidth 33867 20000 GB Bandwidth
port speed 24713 1 Gbps Public & Private Network Uplinks

Here is the final data structure

{"packageId"=>51,
"useHourlyPricing"=>false,
"hardware"=>{"hostname"=>"esxi-fast", "domain"=>"pureapp.ibmcloud.com"},
"location"=>358694,
"prices"=>
[{"id"=>28103},
{"id"=>30463},
{"id"=>30436},
{"id"=>32927},
{"id"=>27537},
{"id"=>33867},
{"id"=>24713},
{"id"=>25014},
{"id"=>34807},
{"id"=>27023},
{"id"=>32500},
{"id"=>32627},
{"id"=>33483},
{"id"=>35310}]}

Verify Order works

but on place order I get following

C:/Work/ruby-2.0.0-p481-x64-mingw32/lib/ruby/2.0.0/xmlrpc/client.rb:264:in `call': The number of server(s) (2) does not match the order quantity (1). (XMLRPC::FaultException)

Working with SL support

There is a syntax error in the data structure the "hardware"=>{"hostname"=>"esxi-fast", "domain"=>"pureapp.ibmcloud.com"} parameter should be updated to "hardware"=>[{"hostname"=>"esxi-fast", "domain"=>"pureapp.ibmcloud.com"}] since the data type of the hardware parameter is an array.

I changed BareMetalServerOrder_Package.rb to

  product_order = {
    'packageId' => @package.id,
    'useHourlyPricing' => false,
    'hardware' => [{ <------------------- Extra '['
      'hostname' => @hostname,
      'domain' => @domain
    }   ] <--------------']'
  }

and it works

adding some reporting examples would be great

Hi, adding some reporting examples would be great, such as how to dig into the details of each device. Who created the device, cost per month, and total cost to date on a device.

Thanks,
Paul

Ruby API Bug

A customer reported the following issue related to ruby client (this is the ticket internal 15654742)

I can reproduce this on the current code base:

[2] pry(main)> SoftLayer::VERSION
=> "3.0.0"

This matches the current repo (and gem update gives nothing for it)

https://github.com/softlayer/softlayer-ruby/blob/33eebb44839a2a781c080c18f66364ad7e99b9fe/lib/softlayer/base.rb

VERSION = "3.0.0" # version history in the CHANGELOG.textile file at the root of the source

The problem is ConfigParser pulls the timeout value as a string but XMLRPC::Client expects an integer, and this never gets translated anywhere along the way.

Line 98 in lib/softlayer/Config.rb
result[:timeout] = softlayer_section['timeout'] if softlayer_section['timeout']

line 91 in lib/softlayer/Client.rb
@network_timeout = settings[:timeout] if settings.has_key?(:timeout)

line 288 in lib/softlayer/Service.rb
@xmlrpc_client = XMLRPC::Client.new2(URI.join(@client.endpoint_url,@service_name).to_s, nil, @client.network_timeout)

This is the line that causes the error since @client.network_timeout is a string

[4] pry(main)> SoftLayer::Service.new('Account').client.network_timeout.class
=> String

And when passed to XMLRPC::Client.new2, produces (this is just standard XMLRPC code, the same XMLRPC library is used with XenServer):

[16] pry(main)> XMLRPC::Client.new2('http://10.80.9.148', nil, "40").call('session.login_with_password','a','b')
NoMethodError: undefined method zero?' for "40":String from /home/main/.rbenv/versions/2.1.1/lib/ruby/2.1.0/timeout.rb:76:intimeout'

Ideally that should be casted to int as soon as it's parsed, but the safest bet would be to ensure the timeout is passed as an int directly to the XMLRPC client.

Virtual Server Order example broken with update to 3.0

I get following running example to order virtual server order

C:/Work/ruby-2.0.0-p481-x64-mingw32/lib/ruby/gems/2.0.0/gems/softlayer_api-3.0.0/lib/softlayer/VirtualServerOrder.rb:159
:in virtual_guest_template': undefined methodname' for {:name=>"lon02"}:Hash (NoMethodError)
from C:/Work/ruby-2.0.0-p481-x64-mingw32/lib/ruby/gems/2.0.0/gems/softlayer_api-3.0.0/lib/softlayer/VirtualServe
rOrder.rb:119:in `verify'

following fixes it

x = SoftLayer::Datacenter.datacenter_named('hou02', client)
puts x
server_order.datacenter = x

it was easier to just specify DC as string

SSL error on Ruby client

Hi, When attempting to execute any of your example scripts with my SL cred I get the below SSL error, the creds are validated. I'm using Ruby 2.0 and the latest softlayer-ruby files. Any help or advice you can provide is appreciated as I would like to get up and running with the Ruby client, but I'm stuck at the starters block.

Thanks,
Paul

Unable to retrieve account information: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:918:in connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Ope nSSL::SSL::SSLError) from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:918:inblock in connect'
from C:/Ruby200-x64/lib/ruby/2.0.0/timeout.rb:66:in timeout' from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:918:inconnect'
from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:862:in do_start' from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:857:instart'
from C:/Ruby200-x64/lib/ruby/2.0.0/xmlrpc/client.rb:472:in do_rpc' from C:/Ruby200-x64/lib/ruby/2.0.0/xmlrpc/client.rb:279:incall2'
from C:/Ruby200-x64/lib/ruby/2.0.0/xmlrpc/client.rb:260:in call' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/softlayer_api-2.1.0/lib/softlayer/Service.rb:278:incall_softlayer_api_with_params'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/softlayer_api-2.1.0/lib/softlayer/Service.rb:207:in method_missing' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/softlayer_api-2.1.0/lib/softlayer/Account.rb:129:inaccount_for_client'
from pm-test-servers.rb:36:in `

'

Add a mechanism to retrieve ticket subjects

Ticket subjects are submitted to the SoftLayer API most often by ID number. There should be a mechanism for retrieving the server's list of ticket subjects.

This topic was extracted from issue #30 and is addressed by the method SoftLayer::Ticket.ticket_subjects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.