cloud:recipe:coding
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
cloud:recipe:coding [2020/05/14 14:51] – [Demo Code] chudler | cloud:recipe:coding [2020/05/14 18:32] (current) – chudler | ||
---|---|---|---|
Line 75: | Line 75: | ||
For your learning, contrast this with the equivalent actions that are taken in the [[ cloud:cli | Command Line Usage Guide ]]. | For your learning, contrast this with the equivalent actions that are taken in the [[ cloud:cli | Command Line Usage Guide ]]. | ||
- | < | + | < |
import openstack | import openstack | ||
from openstack.config import loader | from openstack.config import loader | ||
+ | # to enable debug logging | ||
# openstack.enable_logging(True) | # openstack.enable_logging(True) | ||
config = loader.OpenStackConfig() | config = loader.OpenStackConfig() | ||
Line 85: | Line 86: | ||
# print(flavor.name) | # print(flavor.name) | ||
image = cloud.get_image(' | image = cloud.get_image(' | ||
+ | # pretty print | ||
# cloud.pprint(image) | # cloud.pprint(image) | ||
- | # network = cloud.network.find_network(' | ||
network = cloud.get_network(' | network = cloud.get_network(' | ||
- | # cloud.pprint(network) | ||
try: | try: | ||
server = cloud.create_server(' | server = cloud.create_server(' | ||
- | # cloud.pprint(server) | ||
- | # cloud.pprint(cloud.get_server(' | ||
- | cloud.pprint(cloud.get_server(' | ||
finally: | finally: | ||
cloud.delete_server(' | cloud.delete_server(' | ||
</ | </ |
/var/lib/dokuwiki/data/pages/cloud/recipe/coding.txt · Last modified: 2020/05/14 18:32 by chudler