How to get heat resource-type-list via python heat-client?

asked 2016-09-21 04:37:37 -0600

ckravi gravatar image

updated 2016-09-21 15:32:01 -0600

rbowen gravatar image

How to get heat resource-type-list via python heat-client? The shell commands of heat uses a heatclient.common.http.SessionClient and here list() works. However when I use the python API client (class 'heatclient.v1.client.Client’), and do a resource_types.list(), I get the below error:

*** AttributeError: '_fileobject' object has no attribute 'encoding'

Call flow of heat shell command:

heat resource-type-list
(Pdb) type(hc.http_client)
<class 'heatclient.common.http.SessionClient'>
(Pdb)(Pdb) type(hc.http_client)
<class 'heatclient.common.http.SessionClient'>
 hc.resource_types.list() 
[<ResourceType OS::ContrailV2::InstanceIp>, <ResourceType OS::ContrailV2::RouteTable>, <ResourceType OS::ContrailV2::CustomerAttachment>, <ResourceType OS::ContrailV2::InterfaceRouteTable>, <ResourceType OS::ContrailV2::VirtualDnsRecord>, <ResourceType OS::ContrailV2::PortTuple>, <ResourceType OS::ContrailV2::RouteAggregate>, <ResourceType OS::ContrailV2::BgpAsAService>, <ResourceType OS::ContrailV2::LogicalInterface>, <ResourceType OS::ContrailV2::GlobalVrouterConfig>, <ResourceType OS::ContrailV2::ServiceTemplate>, <ResourceType OS::ContrailV2::VirtualDns>, <ResourceType OS::ContrailV2::ServiceHealthCheck>, <ResourceType OS::ContrailV2::ConfigRoot>, <ResourceType OS::ContrailV2::RoutingInstance>, <ResourceType OS::ContrailV2::ServiceInstance>, <ResourceType OS::ContrailV2::LoadbalancerMember>, <ResourceType OS::ContrailV2::DsaRule>, <ResourceType OS::ContrailV2::Project>, <ResourceType OS::ContrailV2::NetworkPolicy>, <ResourceType OS::ContrailV2::QosQueue>, <ResourceType OS::ContrailV2::AccessControlList>, <ResourceType OS::ContrailV2::PhysicalInterface>, <ResourceType OS::ContrailV2::SecurityGroup>, <ResourceType OS::ContrailV2::LogicalRouter>, <ResourceType OS::ContrailV2::BgpRouter>, <ResourceType OS::ContrailV2::ApiAccessList>, <ResourceType OS::ContrailV2::VirtualMachine>, <ResourceType OS::ContrailV2::VirtualRouter>, <ResourceType OS::ContrailV2::FloatingIp>, <ResourceType OS::ContrailV2::VirtualNetwork>, <ResourceType OS::ContrailV2::RouteTarget>, <ResourceType OS::ContrailV2::FloatingIpPool>, <ResourceType OS::ContrailV2::LoadbalancerHealthmonitor>, <ResourceType OS::ContrailV2::NetworkIpam>, <ResourceType OS::ContrailV2::Loadbalancer>, <ResourceType OS::ContrailV2::Namespace>, <ResourceType OS::ContrailV2::ProviderAttachment>, <ResourceType OS::ContrailV2::QosForwardingClass>, <ResourceType OS::ContrailV2::GlobalSystemConfig>, <ResourceType OS::ContrailV2::LoadbalancerListener>, <ResourceType OS::ContrailV2::PhysicalRouter>, <ResourceType OS::ContrailV2::LoadbalancerPool>, <ResourceType OS::ContrailV2::AnalyticsNode>, <ResourceType OS::ContrailV2::ServiceApplianceSet>, <ResourceType OS::ContrailV2::DiscoveryServiceAssignment>, <ResourceType OS::ContrailV2::VirtualMachineInterface>, <ResourceType OS::ContrailV2::Subnet>, <ResourceType OS::ContrailV2::ConfigNode>, <ResourceType OS::ContrailV2::ServiceAppliance>, <ResourceType OS::ContrailV2::DatabaseNode>, <ResourceType OS::ContrailV2::Domain>, <ResourceType OS::ContrailV2::VirtualIp>, <ResourceType OS::ContrailV2::RoutingPolicy>]

Call flow of python heat API client:

(Pdb) type(hc)
<class 'heatclient.v1.client.Client'>
(Pdb) hc.resource_types.list()
*** AttributeError: '_fileobject' object has no attribute 'encoding'
(Pdb)
edit retag flag offensive close merge delete