Update docs and tests

This commit is contained in:
Zhiwei Liang 2023-07-10 15:31:43 -04:00 committed by Megan Wilhite
parent b9c565f191
commit 0d3f49296e
6 changed files with 19 additions and 81 deletions

View file

@ -3,4 +3,4 @@ salt.cloud.clouds.linode
.. automodule:: salt.cloud.clouds.linode
:members:
:exclude-members: LinodeAPI, LinodeAPIv3, LinodeAPIv4
:exclude-members: LinodeAPI, LinodeAPIv4

View file

@ -301,8 +301,8 @@ be set:
.. code-block:: yaml
my-linode-config:
apikey: asldkgfakl;sdfjsjaslfjaklsdjf;askldjfaaklsjdfhasldsadfghdkf
password: F00barbaz
apikey: asldkgfaklsdfjsjaslfjaklsdjf;askldjfaaklsjdfhasldsadfghdkf
password: F00barbazlonglongp@ssword
ssh_pubkey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKHEOLLbeXgaqRQT9NBAopVz366SdYc0KKX33vAnq+2R user@host
ssh_key_file: ~/.ssh/id_ed25519
driver: linode

View file

@ -24,9 +24,6 @@ Configuration Options
``password``
**(Required)** The default password to set on new VMs. Must be 8 characters with at least one lowercase, uppercase, and numeric.
``api_version``
The version of the Linode API to interact with. Defaults to ``v3``.
``poll_interval``
The rate of time in milliseconds to poll the Linode API for changes. Defaults to ``500``.
@ -44,18 +41,8 @@ Set up the provider cloud configuration file at ``/etc/salt/cloud.providers`` or
my-linode-provider:
driver: linode
api_version: v4
apikey: f4ZsmwtB1c7f85Jdu43RgXVDFlNjuJaeIYV8QMftTqKScEB2vSosFSr...
password: F00barbaz
For use with APIv3 (deprecated):
.. code-block:: yaml
my-linode-provider-v3:
driver: linode
apikey: f4ZsmwtB1c7f85Jdu43RgXVDFlNjuJaeIYV8QMftTqKScEB2vSosFSr...
password: F00barbaz
password: F00barbazverylongp@ssword
Profile Configuration
=====================
@ -67,20 +54,16 @@ Configuration Options
``image``
**(Required)** The image to deploy the boot disk from. This should be an image ID
(e.g. ``linode/ubuntu16.04``); official images start with ``linode/``. For APIv3,
this would be an image label (i.e. Ubuntu 16.04). See `listing images <#listing-images>`_
for more options.
(e.g. ``linode/ubuntu22.04``); official images start with ``linode/``.
``location``
**(Required)** The location of the VM. This should be a Linode region
(e.g. ``us-east``). For APIv3, this would be a datacenter location
(e.g. ``Newark, NJ, USA``). See `listing locations <#listing-locations>`_ for
(e.g. ``us-east``). See `listing locations <#listing-locations>`_ for
more options.
``size``
**(Required)** The size of the VM. This should be a Linode instance type ID
(e.g. ``g6-standard-2``). For APIv3, this would be a plan ID (e.g. ``Linode 2GB``).
See `listing sizes <#listing-sizes>`_ for more options.
(e.g. ``g6-standard-2``). See `listing sizes <#listing-sizes>`_ for more options.
``password`` (overrides provider)
**(*Required)** The default password for the VM. Must be provided at the profile
@ -94,11 +77,6 @@ Configuration Options
``cloneform``
The name of the Linode to clone from.
``disk_size``
**(Deprecated)** The amount of disk space to allocate for the OS disk. This has no
effect with APIv4; the size of the boot disk will be the remainder of disk space
after the swap partition is allocated.
``ssh_interface``
.. versionadded:: 2016.3.0
@ -132,7 +110,7 @@ Set up a profile configuration in ``/etc/salt/cloud.profiles.d/``:
my-linode-profile:
provider: my-linode-provider
size: g6-standard-1
image: linode/alpine3.12
image: linode/ubuntu22.04
location: us-east
The ``my-linode-profile`` can be realized now with a salt command:
@ -157,30 +135,19 @@ A more advanced configuration utlizing all of the configuration options might lo
my-linode-profile-advanced:
provider: my-linode-provider
size: g6-standard-3
image: linode/alpine3.10
location: eu-west
password: bogus123X
size: g6-standard-1
image: linode/ubuntu22.04
location: us-central
password: iamaverylongp@ssword
assign_private_ip: true
ssh_interface: private_ips
ssh_pubkey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB...
swap_size: 512
A legacy configuration for use with APIv3 might look like:
.. code-block:: yaml
my-linode-profile-v3:
provider: my-linode-provider-v3
size: Nanode 1GB
image: Alpine 3.12
location: Fremont, CA, USA
Migrating to APIv4
==================
Linode APIv3 has been deprecated and will be shutdown in the coming months. You can opt-in to using
APIv4 by setting the ``api_version`` provider configuration option to ``v4``.
Linode APIv3 has been removed, and APIv4 is the only available version.
When switching to APIv4, you will also need to generate a new token. See
`here <https://www.linode.com/docs/platform/api/getting-started-with-the-linode-api/#create-an-api-token>`_
@ -193,18 +160,18 @@ Notable Changes
``size``, and ``image`` have moved from accepting label based references to IDs. See the
`profile configuration <#profile-configuration>`_ section for more details.
**The ``disk_size`` profile configuration parameter has been deprecated.** The parameter will not be taken into
**The ``disk_size`` profile configuration parameter has been removed.** The parameter will not be taken into
account when creating new VMs while targeting APIv4. See the ``disk_size`` description under the
`profile configuration <#profile-configuration>`_ section for more details.
**The ``boot`` function no longer requires a ``config_id``.** A config can be inferred by the API instead when booting.
**The ``clone`` function has renamed parameters to match convention.** The old version of these parameters will not
be supported when targeting APIv4.
* ``datacenter_id`` has been deprecated in favor of ``location``.
* ``plan_id`` has been deprecated in favor of ``size``.
**The ``clone`` function has renamed parameters to match convention.** The old version of these parameters are no longer
supported.
* ``datacenter_id`` has been removed and replaced by ``location``.
* ``plan_id`` has been removed and replaced by ``size``.
**The ``get_plan_id`` function has been deprecated and will not be supported by APIv4.** IDs are now the only way
**The ``get_plan_id`` function has been removed and is not supported by APIv4.** IDs are now the only way
of referring to a "plan" (or type/size).
Query Utilities

View file

@ -15,20 +15,6 @@ class LinodeTest(CloudTest):
PROVIDER = "linode"
REQUIRED_PROVIDER_CONFIG_ITEMS = ("apikey", "password")
def setUp(self):
"""
Sets up the test requirements
"""
super().setUp()
# check if the Linode APIv4 cloud provider
if self.profile_str + "-v4:" not in self.providers:
self.skipTest(
"Configuration file for Linode using api_version ``v4`` was not found "
"but is required to run all tests. Check linode.conf files in "
"tests/integration/files/conf/cloud.*.d/ to run these tests."
)
def _test_instance(self, profile):
"""
Test creating an instance on Linode for a given profile.
@ -44,6 +30,3 @@ class LinodeTest(CloudTest):
def test_instance(self):
return self._test_instance("linode-test")
def test_instance_v4(self):
return self._test_instance("linode-test-v4")

View file

@ -1,11 +1,5 @@
linode-test:
provider: linode-config
size: Linode 1GB
image: Alpine 3.12
location: Newark, NJ, USA
linode-test-v4:
provider: linode-config-v4
size: g6-standard-1
image: linode/alpine3.12
location: us-east

View file

@ -2,9 +2,3 @@ linode-config:
apikey: ''
password: ''
driver: linode
linode-config-v4:
apikey: ''
password: ''
driver: linode
api_version: v4