Revision history [back]

click to hide/show revision 1
initial version

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

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)

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

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)

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)