hw = {
'datacenter': {'name': 'che01'},
'hostname': 'baremetal',
'domain': 'cds.net',
'hourlyBillingFlag': True,
'fixedConfigurationPreset': {'keyName': 'S1270_32GB_1X1TBSATA_NORAID'},
'networkComponents': [{
'maxSpeed': 1000
# 'redundancyEnabledFlag': True,
}],
'operatingSystemReferenceCode': 'UBUNTU_14_64'
}
productOrder = slClient['Hardware'].generateOrderTemplate(hw)
order = slClient['Hardware'].createObject(productOrder)
Running above code, which is giving this error:
SoftLayer.exceptions.SoftLayerAPIError: SoftLayerAPIError(SoftLayer_Exception_MissingCreationProperty): The property 'hostname' must be set to create an instance of 'SoftLayer_Hardware' I hostname is specified, still it is giving hostname property is not set.
Can you please let me know where I am doing incorrectly?
the issue is that once you call the generateOrderTemplate method, it creates an order container which work for the verifyOrder or placeOrder methods.
So you do not have to use the createObject method, instead use the placeOrder method
e.g.
import SoftLayer
slClient = SoftLayer.Client()
hw = { 'datacenter':
{'name': 'che01'},
'hostname': 'baremetal',
'domain': 'cds.net',
'hourlyBillingFlag': True,
'fixedConfigurationPreset':
{'keyName': 'S1270_32GB_1X1TBSATA_NORAID'},
'networkComponents':
[{ 'maxSpeed': 1000 #'redundancyEnabledFlag': True
, }],
'operatingSystemReferenceCode': 'UBUNTU_14_64' }
productOrder = slClient['Hardware'].generateOrderTemplate(hw)
order = slClient['Product_Order'].placeOrder(productOrder)