本文介绍了如何使用Ruby获取所有SoftLayer机器的订单用户名和ProvisionDate?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Ruby,我正在拨打以下电话:

Using Ruby I'm making a call like:

client = SoftLayer::Client.new(:username => user, :api_key => api_key, :timeout => 999999)
client['Account'].object_mask("mask[id, hostname, fullyQualifiedDomainName, provisionDate, datacenter[name], billingItem[recurringFee, associatedChildren[recurringFee], orderItem[description, order[userRecord[username], id]]], tagReferences[tagId, tag[name]], primaryIpAddress, primaryBackendIpAddress]").getHardware

但是,只有某些机器返回provisionDate,并且只有一些返回orderItem信息.如何持续获得每台计算机的此信息?是什么原因导致一台计算机返回此数据而另一台计算机不返回该数据?

But only some machines return a provisionDate and only some return orderItem information. How can I consistently get this information for each machine? What would cause one machine to return this data and another machine to not?

示例输出:

{"fullyQualifiedDomainName"=>"<removed_by_me>",
 "hostname"=>"<removed_by_me>",
 "id"=>167719,
 "provisionDate"=>"",
 "primaryBackendIpAddress"=>"<removed_by_me>",
 "primaryIpAddress"=>"<removed_by_me>",
 "billingItem"=>
  {"recurringFee"=>"506.78",
   "associatedChildren"=>
    [<removed_by_me>]},
 "datacenter"=>{"name"=>"dal09"},
  "tagReferences"=>
  [{"tagId"=>139415, "tag"=>{"name"=>"<removed_by_me>"}},
   {"tagId"=>139417, "tag"=>{"name"=>"<removed_by_me>"}},
   {"tagId"=>140549, "tag"=>{"name"=>"<removed_by_me>"}}]}

要清楚,大多数机器返回此数据,所以我试图了解为什么有些机器不返回.

To be clear, most machines return this data so I'm trying to understand why some do not.

推荐答案

请参阅以下配置步骤,以下是需要考虑的一些步骤:

Please see the following provisioning steps, below is a little flow to consider:

1.  Order a Server

Result: 
* An orderId is assigned to the server
* The createDate has a new value
* activeTransaction value is =  Null
* provisionDate value is = Null

2.  The order is approved

Result: 
* activeTransaction value is <> Null
* provisionDate value = Null

3.  Server  is already provisioned

Result:
* activeTransaction value is = Null
* provisionDate value has a New value
* billingItem property has a new value

要查看您的计算机是否仍为activeTransaction,请执行以下操作:

To see if your machines have still "activeTransaction", please execute:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Hardware_Server/[server_id]/getActiveTransaction
Method: GET

现在,在查看示例响应后,该服务器在完成配置时出现了一些问题;因此,此步骤是手动完成的,但出于任何原因都未设置provisionDate(如果要设置ProvisionDate,请打开票证).这是特例.我可以看到另一台服务器具有类似的行为.但是其他没有provisionDate的服务器仍然是activeTransaction<>null(这意味着尚未配置这些服务器).

Now, after reviewing your example response, this server had some problems when completing the provisioning; for that reason this step was completed manually but the provisionDate was not set for any reason(please open a ticket if you want that the provisionDate can be set) . This is a special case. I can see that another server has a similar behavior. But the other servers that don’t have provisionDate, have still "activeTransaction<>null" (it means that these server are not provisioned yet).

其他属性可以帮助您知道尽管正在执行其他类型的事务,但您的计算机已经配置好了,它是hardwareStatus,它应该具有"ACTIVE"值.

Other property can help you to know that your machine has been already provisioned although other kind of transaction is being executed, is "hardwareStatus", it should have "ACTIVE" value.

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getHardware?objectMask=mask[id, hostname, fullyQualifiedDomainName, provisionDate,hardwareStatus]
Method: GET

响应应该是这样的:

{
"fullyQualifiedDomainName": "myhostname.softlayer.com"
"hostname": " myhostname"
"id": 1234567
"provisionDate": "2015-06-29T00:21:39-05:00"
"hardwareStatus": {
"id": 5
"status": "ACTIVE"
}

这篇关于如何使用Ruby获取所有SoftLayer机器的订单用户名和ProvisionDate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 15:22