Skip to content

Commit 713c9c1

Browse files
authored
Merge pull request #652 from linode/dev
v5.40.0
2 parents f0e3595 + 42ca199 commit 713c9c1

29 files changed

+290
-57
lines changed

.github/pull_request_template.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@
77
**What are the steps to reproduce the issue or verify the changes?**
88

99
**How do I run the relevant unit/integration tests?**
10-
11-
## 📷 Preview
12-
13-
**If applicable, include a screenshot or code snippet of this change. Otherwise, please remove this section.**

.github/workflows/e2e-test-pr.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ on:
2727
pull_request_number:
2828
description: 'The number of the PR.'
2929
required: false
30+
test_report_upload:
31+
description: 'Indicates whether to upload the test report to object storage. Defaults to "false"'
32+
required: false
33+
default: 'false'
34+
type: choice
35+
options:
36+
- 'true'
37+
- 'false'
3038

3139
name: PR E2E Tests
3240

@@ -101,7 +109,7 @@ jobs:
101109
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
102110

103111
- name: Upload test results
104-
if: always()
112+
if: always() && github.repository == 'linode/linode_api4-python' && (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.test_report_upload == 'true'))
105113
run: |
106114
filename=$(ls | grep -E '^[0-9]{12}_sdk_test_report\.xml$')
107115
python3 e2e_scripts/tod_scripts/xml_to_obj_storage/scripts/add_gha_info_to_xml.py \

.github/workflows/e2e-test.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ on:
4141
options:
4242
- 'true'
4343
- 'false'
44+
test_report_upload:
45+
description: 'Indicates whether to upload the test report to object storage. Defaults to "false"'
46+
type: choice
47+
required: false
48+
default: 'false'
49+
options:
50+
- 'true'
51+
- 'false'
4452
push:
4553
branches:
4654
- main
@@ -172,7 +180,8 @@ jobs:
172180
process-upload-report:
173181
runs-on: ubuntu-latest
174182
needs: [integration-tests]
175-
if: always() && github.repository == 'linode/linode_api4-python' # Run even if integration tests fail and only on main repository
183+
# Run even if integration tests fail on main repository AND push event OR test_report_upload is true in case of manual run
184+
if: always() && github.repository == 'linode/linode_api4-python' && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.test_report_upload == 'true'))
176185
outputs:
177186
summary: ${{ steps.set-test-summary.outputs.summary }}
178187

@@ -271,4 +280,4 @@ jobs:
271280
payload: |
272281
channel: ${{ secrets.SLACK_CHANNEL_ID }}
273282
thread_ts: "${{ steps.main_message.outputs.ts }}"
274-
text: "${{ needs.process-upload-report.outputs.summary }}"
283+
text: "${{ needs.process-upload-report.outputs.summary }}"

linode_api4/groups/linode.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,6 @@ def instance_create(
335335
:type network_helper: bool
336336
:param maintenance_policy: The slug of the maintenance policy to apply during maintenance.
337337
If not provided, the default policy (linode/migrate) will be applied.
338-
NOTE: This field is in beta and may only
339-
function if base_url is set to `https://api.linode.com/v4beta`.
340338
:type maintenance_policy: str
341339
342340
:returns: A new Instance object, or a tuple containing the new Instance and

linode_api4/groups/lke.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def cluster_create(
6262
self,
6363
region,
6464
label,
65-
node_pools,
6665
kube_version,
66+
node_pools: Optional[list] = None,
6767
control_plane: Union[
6868
LKEClusterControlPlaneOptions, Dict[str, Any]
6969
] = None,
@@ -119,6 +119,15 @@ def cluster_create(
119119
:returns: The new LKE Cluster
120120
:rtype: LKECluster
121121
"""
122+
if node_pools is None:
123+
node_pools = []
124+
125+
if len(node_pools) == 0 and (
126+
tier is None or tier.lower() != "enterprise"
127+
):
128+
raise ValueError(
129+
"LKE standard clusters must have at least one node pool."
130+
)
122131

123132
params = {
124133
"label": label,

linode_api4/groups/maintenance.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ class MaintenanceGroup(Group):
99

1010
def maintenance_policies(self):
1111
"""
12-
.. note:: This endpoint is in beta. This will only function if base_url is set to `https://api.linode.com/v4beta`.
13-
1412
Returns a collection of MaintenancePolicy objects representing
1513
available maintenance policies that can be applied to Linodes
1614

linode_api4/objects/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .dbase import DerivedBase
44
from .serializable import JSONObject
55
from .filtering import and_, or_
6-
from .region import Region
6+
from .region import Region, Capability
77
from .image import Image
88
from .linode import *
99
from .linode_interfaces import *

linode_api4/objects/account.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,7 @@ class AccountSettings(Base):
218218
"object_storage": Property(),
219219
"backups_enabled": Property(mutable=True),
220220
"interfaces_for_new_linodes": Property(mutable=True),
221-
"maintenance_policy": Property(
222-
mutable=True
223-
), # Note: This field is only available when using v4beta.
221+
"maintenance_policy": Property(mutable=True),
224222
}
225223

226224

@@ -249,7 +247,7 @@ class Event(Base):
249247
"duration": Property(),
250248
"secondary_entity": Property(),
251249
"message": Property(),
252-
"maintenance_policy_set": Property(), # Note: This field is only available when using v4beta.
250+
"maintenance_policy_set": Property(),
253251
"description": Property(),
254252
"source": Property(),
255253
"not_before": Property(is_datetime=True),

linode_api4/objects/linode.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import copy
22
import string
33
import sys
4+
import warnings
45
from dataclasses import dataclass, field
56
from datetime import datetime
67
from enum import Enum
@@ -217,7 +218,7 @@ def resize(self, new_size):
217218
class Kernel(Base):
218219
"""
219220
The primary component of every Linux system. The kernel interfaces
220-
with the system’s hardware and it controls the operating system’s core functionality.
221+
with the system’s hardware, and it controls the operating system’s core functionality.
221222
222223
Your Compute Instance is capable of running one of three kinds of kernels:
223224
@@ -237,6 +238,10 @@ class Kernel(Base):
237238
to compile the kernel from source than to download it from your package manager. For more
238239
information on custom compiled kernels, review our guides for Debian, Ubuntu, and CentOS.
239240
241+
.. note::
242+
The ``xen`` property is deprecated and is no longer returned by the API.
243+
It is maintained for backward compatibility only.
244+
240245
API Documentation: https://techdocs.akamai.com/linode-api/reference/get-kernel
241246
"""
242247

@@ -256,6 +261,16 @@ class Kernel(Base):
256261
"pvops": Property(),
257262
}
258263

264+
def __getattribute__(self, name: str) -> object:
265+
if name == "xen":
266+
warnings.warn(
267+
"The 'xen' property of Kernel is deprecated and is no longer "
268+
"returned by the API. It is maintained for backward compatibility only.",
269+
DeprecationWarning,
270+
stacklevel=2,
271+
)
272+
return super().__getattribute__(name)
273+
259274

260275
class Type(Base):
261276
"""
@@ -800,9 +815,7 @@ class Instance(Base):
800815
"lke_cluster_id": Property(),
801816
"capabilities": Property(unordered=True),
802817
"interface_generation": Property(),
803-
"maintenance_policy": Property(
804-
mutable=True
805-
), # Note: This field is only available when using v4beta.
818+
"maintenance_policy": Property(mutable=True),
806819
"locks": Property(unordered=True),
807820
}
808821

linode_api4/objects/lock.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class LockType(StrEnum):
1010
"""
1111
LockType defines valid values for resource lock types.
1212
13-
API Documentation: https://techdocs.akamai.com/linode-api/reference/post-lock
13+
API Documentation: TBD
1414
"""
1515

1616
cannot_delete = "cannot_delete"
@@ -22,7 +22,7 @@ class LockEntity(JSONObject):
2222
"""
2323
Represents the entity that is locked.
2424
25-
API Documentation: https://techdocs.akamai.com/linode-api/reference/get-lock
25+
API Documentation: TBD
2626
"""
2727

2828
id: int = 0
@@ -35,7 +35,7 @@ class Lock(Base):
3535
"""
3636
A resource lock that prevents deletion or modification of a resource.
3737
38-
API Documentation: https://techdocs.akamai.com/linode-api/reference/get-lock
38+
API Documentation: TBD
3939
"""
4040

4141
api_endpoint = "/locks/{id}"

0 commit comments

Comments
 (0)