Merge ~powersj/cloud-init:docs/datasource into cloud-init:master

Proposed by Joshua Powers
Status: Merged
Approved by: Chad Smith
Approved revision: 59c6911df9eec387113275f4b7771f579f30e606
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~powersj/cloud-init:docs/datasource
Merge into: cloud-init:master
Diff against target: 218 lines (+92/-94)
1 file modified
doc/rtd/topics/datasources.rst (+92/-94)
Reviewer Review Type Date Requested Status
Chad Smith Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+372647@code.launchpad.net

Commit message

docs: cleanup output & order of datasource page

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:59c6911df9eec387113275f4b7771f579f30e606
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1129/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1129//rebuild

review: Approve (continuous-integration)
Revision history for this message
Chad Smith (chad.smith) wrote :

let's bring some of these home. Thanks Josh

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/doc/rtd/topics/datasources.rst b/doc/rtd/topics/datasources.rst
index 2148cd5..8e58be9 100644
--- a/doc/rtd/topics/datasources.rst
+++ b/doc/rtd/topics/datasources.rst
@@ -1,89 +1,57 @@
1.. _datasources:1.. _datasources:
22
3***********
4Datasources3Datasources
5***********4***********
65
7What is a datasource?
8=====================
9
10Datasources are sources of configuration data for cloud-init that typically6Datasources are sources of configuration data for cloud-init that typically
11come from the user (aka userdata) or come from the stack that created the7come from the user (e.g. userdata) or come from the cloud that created the
12configuration drive (aka metadata). Typical userdata would include files,8configuration drive (e.g. metadata). Typical userdata would include files,
13yaml, and shell scripts while typical metadata would include server name,9yaml, and shell scripts while typical metadata would include server name,
14instance id, display name and other cloud specific details. Since there are10instance id, display name and other cloud specific details.
15multiple ways to provide this data (each cloud solution seems to prefer its
16own way) internally a datasource abstract class was created to allow for a
17single way to access the different cloud systems methods to provide this data
18through the typical usage of subclasses.
19
20Any metadata processed by cloud-init's datasources is persisted as
21``/run/cloud-init/instance-data.json``. Cloud-init provides tooling
22to quickly introspect some of that data. See :ref:`instance_metadata` for
23more information.
24
25
26Datasource API
27--------------
28The current interface that a datasource object must provide is the following:
29
30.. sourcecode:: python
3111
32 # returns a mime multipart message that contains12Since there are multiple ways to provide this data (each cloud solution seems
33 # all the various fully-expanded components that13to prefer its own way) internally a datasource abstract class was created to
34 # were found from processing the raw userdata string14allow for a single way to access the different cloud systems methods to provide
35 # - when filtering only the mime messages targeting15this data through the typical usage of subclasses.
36 # this instance id will be returned (or messages with
37 # no instance id)
38 def get_userdata(self, apply_filter=False)
39
40 # returns the raw userdata string (or none)
41 def get_userdata_raw(self)
4216
43 # returns a integer (or none) which can be used to identify17Any metadata processed by cloud-init's datasources is persisted as
44 # this instance in a group of instances which are typically18``/run/cloud-init/instance-data.json``. Cloud-init provides tooling to quickly
45 # created from a single command, thus allowing programmatic19introspect some of that data. See :ref:`instance_metadata` for more
46 # filtering on this launch index (or other selective actions)20information.
47 @property
48 def launch_index(self)
49
50 # the data sources' config_obj is a cloud-config formatted
51 # object that came to it from ways other than cloud-config
52 # because cloud-config content would be handled elsewhere
53 def get_config_obj(self)
54
55 #returns a list of public ssh keys
56 def get_public_ssh_keys(self)
57
58 # translates a device 'short' name into the actual physical device
59 # fully qualified name (or none if said physical device is not attached
60 # or does not exist)
61 def device_name_to_device(self, name)
6221
63 # gets the locale string this instance should be applying22Known Sources
64 # which typically used to adjust the instances locale settings files23=============
65 def get_locale(self)
6624
67 @property25The following is a list of documents for each supported datasource:
68 def availability_zone(self)
6926
70 # gets the instance id that was assigned to this instance by the27.. toctree::
71 # cloud provider or when said instance id does not exist in the backing28 :titlesonly:
72 # metadata this will return 'iid-datasource'
73 def get_instance_id(self)
7429
75 # gets the fully qualified domain name that this host should be using30 datasources/aliyun.rst
76 # when configuring network or hostname releated settings, typically31 datasources/altcloud.rst
77 # assigned either by the cloud provider or the user creating the vm32 datasources/ec2.rst
78 def get_hostname(self, fqdn=False)33 datasources/azure.rst
34 datasources/cloudsigma.rst
35 datasources/cloudstack.rst
36 datasources/configdrive.rst
37 datasources/digitalocean.rst
38 datasources/exoscale.rst
39 datasources/fallback.rst
40 datasources/gce.rst
41 datasources/maas.rst
42 datasources/nocloud.rst
43 datasources/opennebula.rst
44 datasources/openstack.rst
45 datasources/oracle.rst
46 datasources/ovf.rst
47 datasources/smartos.rst
7948
80 def get_package_mirror_info(self)
8149
50Creation
51========
8252
83Adding a new Datasource
84-----------------------
85The datasource objects have a few touch points with cloud-init. If you53The datasource objects have a few touch points with cloud-init. If you
86are interested in adding a new datasource for your cloud platform you'll54are interested in adding a new datasource for your cloud platform you will
87need to take care of the following items:55need to take care of the following items:
8856
89* **Identify a mechanism for positive identification of the platform**:57* **Identify a mechanism for positive identification of the platform**:
@@ -139,31 +107,61 @@ need to take care of the following items:
139 file in ``doc/datasources/<cloudplatform>.rst``107 file in ``doc/datasources/<cloudplatform>.rst``
140108
141109
142Datasource Documentation110API
143========================111===
144The following is a list of the implemented datasources.
145Follow for more information.
146112
147.. toctree::113The current interface that a datasource object must provide is the following:
148 :maxdepth: 2
149114
150 datasources/aliyun.rst115.. sourcecode:: python
151 datasources/altcloud.rst116
152 datasources/azure.rst117 # returns a mime multipart message that contains
153 datasources/cloudsigma.rst118 # all the various fully-expanded components that
154 datasources/cloudstack.rst119 # were found from processing the raw user data string
155 datasources/configdrive.rst120 # - when filtering only the mime messages targeting
156 datasources/digitalocean.rst121 # this instance id will be returned (or messages with
157 datasources/ec2.rst122 # no instance id)
158 datasources/exoscale.rst123 def get_userdata(self, apply_filter=False)
159 datasources/maas.rst124
160 datasources/nocloud.rst125 # returns the raw userdata string (or none)
161 datasources/opennebula.rst126 def get_userdata_raw(self)
162 datasources/openstack.rst127
163 datasources/oracle.rst128 # returns a integer (or none) which can be used to identify
164 datasources/ovf.rst129 # this instance in a group of instances which are typically
165 datasources/smartos.rst130 # created from a single command, thus allowing programmatic
166 datasources/fallback.rst131 # filtering on this launch index (or other selective actions)
167 datasources/gce.rst132 @property
133 def launch_index(self)
134
135 # the data sources' config_obj is a cloud-config formatted
136 # object that came to it from ways other than cloud-config
137 # because cloud-config content would be handled elsewhere
138 def get_config_obj(self)
139
140 #returns a list of public ssh keys
141 def get_public_ssh_keys(self)
142
143 # translates a device 'short' name into the actual physical device
144 # fully qualified name (or none if said physical device is not attached
145 # or does not exist)
146 def device_name_to_device(self, name)
147
148 # gets the locale string this instance should be applying
149 # which typically used to adjust the instances locale settings files
150 def get_locale(self)
151
152 @property
153 def availability_zone(self)
154
155 # gets the instance id that was assigned to this instance by the
156 # cloud provider or when said instance id does not exist in the backing
157 # metadata this will return 'iid-datasource'
158 def get_instance_id(self)
159
160 # gets the fully qualified domain name that this host should be using
161 # when configuring network or hostname related settings, typically
162 # assigned either by the cloud provider or the user creating the vm
163 def get_hostname(self, fqdn=False)
164
165 def get_package_mirror_info(self)
168166
169.. vi: textwidth=78167.. vi: textwidth=79

Subscribers

People subscribed via source and target branches