Skip to content

Commit

Permalink
Merge pull request #516 from linode/dev
Browse files Browse the repository at this point in the history
v0.26.0
  • Loading branch information
lgarber-akamai committed Jun 10, 2024
2 parents cf84ef9 + 1b615fb commit 372851c
Show file tree
Hide file tree
Showing 29 changed files with 533 additions and 147 deletions.
83 changes: 53 additions & 30 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,58 +16,91 @@ jobs:
run:
working-directory: .ansible/collections/ansible_collections/linode/cloud
steps:
- name: checkout repo
- name: Checkout repo
uses: actions/checkout@v3
with:
path: .ansible/collections/ansible_collections/linode/cloud
fetch-depth: 0
submodules: 'recursive'

- name: update packages
- name: Update packages
run: sudo apt-get update -y

- name: install make
run: sudo apt-get install -y build-essential

- name: setup python 3
uses: actions/setup-python@v4
- name: Setup Python 3
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.x'

- name: install dependencies
- name: Install dependencies
run: make deps

- name: install ansible dependencies
- name: Install ansible dependencies
run: ansible-galaxy collection install amazon.aws:==6.0.1

- name: install collection
- name: Install Collection
run: make install

- name: replace existing keys
- name: Replace Existing Keys
run: rm -rf ~/.ansible/test && mkdir -p ~/.ansible/test && ssh-keygen -m PEM -q -t rsa -N '' -f ~/.ansible/test/id_rsa

- name: run tests
- name: Run Integration Tests
run: |
if ! make testall > test_output.txt; then
echo "EXIT_STATUS=1" >> $GITHUB_ENV
fi
cat test_output.txt
make testall
env:
LINODE_API_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
ANSIBLE_CALLBACKS_ENABLED: "junit"

- name: Set release version env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Upload Test Report as Artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: xml-test-reports
if-no-files-found: ignore
path: '.ansible/collections/ansible_collections/linode/cloud/tests/output/junit'
retention-days: 1


process-upload-report:
runs-on: ubuntu-latest
needs: [run-tests]
if: always() # Run even if previous job fails

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install Python dependencies
run: pip3 install requests wheel boto3

# Create directory if it doesn't exist
- name: Create output directory
run: mkdir -p tests/output/junit

- name: Download test report
uses: actions/download-artifact@v4
with:
name: xml-test-reports # Specify the artifact name from the 'run-tests' job
path: tests/output/junit
continue-on-error: true # Continue even if artifact download fails

- name: Merge all test xmls in output directory
run: |
ls -R tests/output/junit
python tod_scripts/merge_ansible_results.py
- name: Add additional information to XML report
run: |
filename=$(ls | grep -E '^[0-9]{12}_ansible_merged\.xml$')
python tod_scripts/add_to_xml_test_report.py \
--branch_name "${{ env.RELEASE_VERSION }}" \
--branch_name "${GITHUB_REF#refs/*/}" \
--gha_run_id "$GITHUB_RUN_ID" \
--gha_run_number "$GITHUB_RUN_NUMBER" \
--xmlfile "${filename}"
Expand All @@ -79,13 +112,3 @@ jobs:
env:
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}

- name: Test Execution Status Handler
run: |
if [[ "$EXIT_STATUS" != 0 ]]; then
echo "Test execution contains failure(s), check Run Integration tests step above"
exit $EXIT_STATUS
else
echo "Tests passed!"
fi
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Name | Description |
--- | ------------ |
[linode.cloud.account_availability_info](./docs/modules/account_availability_info.md)|Get info about a Linode Account Availability.|
[linode.cloud.account_info](./docs/modules/account_info.md)|Get info about a Linode Account.|
[linode.cloud.child_account_info](./docs/modules/child_account_info.md)|Get info about a Linode Child Account.|
[linode.cloud.database_mysql_info](./docs/modules/database_mysql_info.md)|Get info about a Linode MySQL Managed Database.|
[linode.cloud.database_postgresql_info](./docs/modules/database_postgresql_info.md)|Get info about a Linode PostgreSQL Managed Database.|
[linode.cloud.domain_info](./docs/modules/domain_info.md)|Get info about a Linode Domain.|
Expand Down Expand Up @@ -87,6 +88,7 @@ Modules for retrieving and filtering on multiple Linode resources.
Name | Description |
--- | ------------ |
[linode.cloud.account_availability_list](./docs/modules/account_availability_list.md)|List and filter on Account Availabilities.|
[linode.cloud.child_account_list](./docs/modules/child_account_list.md)|List and filter on Child Account.|
[linode.cloud.database_engine_list](./docs/modules/database_engine_list.md)|List and filter on Managed Database engine types.|
[linode.cloud.database_list](./docs/modules/database_list.md)|List and filter on Linode Managed Databases.|
[linode.cloud.domain_list](./docs/modules/domain_list.md)|List and filter on Domains.|
Expand Down
67 changes: 67 additions & 0 deletions docs/modules/child_account_info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# child_account_info

Get info about a Linode Child Account.

- [Minimum Required Fields](#minimum-required-fields)
- [Examples](#examples)
- [Parameters](#parameters)
- [Return Values](#return-values)

## Minimum Required Fields
| Field | Type | Required | Description |
|-------------|-------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `api_token` | `str` | **Required** | The Linode account personal access token. It is necessary to run the module. <br/>It can be exposed by the environment variable `LINODE_API_TOKEN` instead. <br/>See details in [Usage](https://github.com/linode/ansible_linode?tab=readme-ov-file#usage). |

## Examples

```yaml
- name: Get info about a Child Account by EUUID
linode.cloud.child_account_info:
euuid: "FFFFFFFF-FFFF-FFFF-FFFFFFFFFFFFFFFF"
```
## Parameters
| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `euuid` | <center>`str`</center> | <center>**Required**</center> | The EUUID of the Child Account to resolve. |

## Return Values

- `child_account` - The returned Child Account.

- Sample Response:
```json
{
"active_since": "2018-01-01T00:01:01",
"address_1": "123 Main Street",
"address_2": "Suite A",
"balance": 200,
"balance_uninvoiced": 145,
"billing_source": "external",
"capabilities": [
"Linodes",
"NodeBalancers",
"Block Storage",
"Object Storage"
],
"city": "Philadelphia",
"company": "Linode LLC",
"country": "US",
"credit_card": {
"expiry": "11/2022",
"last_four": 1111
},
"email": "[email protected]",
"euuid": "E1AF5EEC-526F-487D-B317EBEB34C87D71",
"first_name": "John",
"last_name": "Smith",
"phone": "215-555-1212",
"state": "PA",
"tax_id": "ATU99999999",
"zip": "19102-1234"
}
```


76 changes: 76 additions & 0 deletions docs/modules/child_account_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# child_account_list

List and filter on Child Account.

- [Minimum Required Fields](#minimum-required-fields)
- [Examples](#examples)
- [Parameters](#parameters)
- [Return Values](#return-values)

## Minimum Required Fields
| Field | Type | Required | Description |
|-------------|-------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `api_token` | `str` | **Required** | The Linode account personal access token. It is necessary to run the module. <br/>It can be exposed by the environment variable `LINODE_API_TOKEN` instead. <br/>See details in [Usage](https://github.com/linode/ansible_linode?tab=readme-ov-file#usage). |

## Examples

```yaml
- name: List all of the Child Accounts under the current Account
linode.cloud.child_account_list: {}
```
## Parameters
| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `order` | <center>`str`</center> | <center>Optional</center> | The order to list Child Account in. **(Choices: `desc`, `asc`; Default: `asc`)** |
| `order_by` | <center>`str`</center> | <center>Optional</center> | The attribute to order Child Account by. |
| [`filters` (sub-options)](#filters) | <center>`list`</center> | <center>Optional</center> | A list of filters to apply to the resulting Child Account. |
| `count` | <center>`int`</center> | <center>Optional</center> | The number of Child Account to return. If undefined, all results will be returned. |

### filters

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `name` | <center>`str`</center> | <center>**Required**</center> | The name of the field to filter on. Valid filterable fields can be found [here](). |
| `values` | <center>`list`</center> | <center>**Required**</center> | A list of values to allow for this field. Fields will pass this filter if at least one of these values matches. |

## Return Values

- `child_accounts` - The returned Child Account.

- Sample Response:
```json
{
"active_since": "2018-01-01T00:01:01",
"address_1": "123 Main Street",
"address_2": "Suite A",
"balance": 200,
"balance_uninvoiced": 145,
"billing_source": "external",
"capabilities": [
"Linodes",
"NodeBalancers",
"Block Storage",
"Object Storage"
],
"city": "Philadelphia",
"company": "Linode LLC",
"country": "US",
"credit_card": {
"expiry": "11/2022",
"last_four": 1111
},
"email": "[email protected]",
"euuid": "E1AF5EEC-526F-487D-B317EBEB34C87D71",
"first_name": "John",
"last_name": "Smith",
"phone": "215-555-1212",
"state": "PA",
"tax_id": "ATU99999999",
"zip": "19102-1234"
}
```


1 change: 1 addition & 0 deletions docs/modules/firewall.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Manage Linode Firewalls.
| [`devices` (sub-options)](#devices) | <center>`list`</center> | <center>Optional</center> | The devices that are attached to this Firewall. **(Updatable)** |
| [`rules` (sub-options)](#rules) | <center>`dict`</center> | <center>Optional</center> | The inbound and outbound access rules to apply to this Firewall. **(Updatable)** |
| `status` | <center>`str`</center> | <center>Optional</center> | The status of this Firewall. **(Updatable)** |
| `tags` | <center>`list`</center> | <center>Optional</center> | A list of tags to apply to this Firewall. **(Updatable)** |

### devices

Expand Down
1 change: 1 addition & 0 deletions docs/modules/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Manage a Linode User.
{
"email": "[email protected]",
"restricted": true,
"user_type": "default",
"ssh_keys": [
"home-pc",
"laptop"
Expand Down
1 change: 1 addition & 0 deletions docs/modules/user_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Get info about a Linode User.
{
"email": "[email protected]",
"restricted": true,
"user_type": "default",
"ssh_keys": [
"home-pc",
"laptop"
Expand Down
1 change: 1 addition & 0 deletions docs/modules/user_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ List Users.
{
"email": "[email protected]",
"restricted": true,
"user_type": "default",
"ssh_keys": [
"home-pc",
"laptop"
Expand Down
37 changes: 37 additions & 0 deletions plugins/module_utils/doc_fragments/child_account_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""Documentation fragments for the child_account_info module"""

result_child_account_samples = ['''{
"active_since": "2018-01-01T00:01:01",
"address_1": "123 Main Street",
"address_2": "Suite A",
"balance": 200,
"balance_uninvoiced": 145,
"billing_source": "external",
"capabilities": [
"Linodes",
"NodeBalancers",
"Block Storage",
"Object Storage"
],
"city": "Philadelphia",
"company": "Linode LLC",
"country": "US",
"credit_card": {
"expiry": "11/2022",
"last_four": 1111
},
"email": "[email protected]",
"euuid": "E1AF5EEC-526F-487D-B317EBEB34C87D71",
"first_name": "John",
"last_name": "Smith",
"phone": "215-555-1212",
"state": "PA",
"tax_id": "ATU99999999",
"zip": "19102-1234"
}''']


specdoc_examples = ['''
- name: Get info about a Child Account by EUUID
linode.cloud.child_account_info:
euuid: "FFFFFFFF-FFFF-FFFF-FFFFFFFFFFFFFFFF"''']
35 changes: 35 additions & 0 deletions plugins/module_utils/doc_fragments/child_account_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Documentation fragments for the child_account_list module"""

specdoc_examples = ['''
- name: List all of the Child Accounts under the current Account
linode.cloud.child_account_list: {}''']

result_child_accounts_samples = ['''{
"active_since": "2018-01-01T00:01:01",
"address_1": "123 Main Street",
"address_2": "Suite A",
"balance": 200,
"balance_uninvoiced": 145,
"billing_source": "external",
"capabilities": [
"Linodes",
"NodeBalancers",
"Block Storage",
"Object Storage"
],
"city": "Philadelphia",
"company": "Linode LLC",
"country": "US",
"credit_card": {
"expiry": "11/2022",
"last_four": 1111
},
"email": "[email protected]",
"euuid": "E1AF5EEC-526F-487D-B317EBEB34C87D71",
"first_name": "John",
"last_name": "Smith",
"phone": "215-555-1212",
"state": "PA",
"tax_id": "ATU99999999",
"zip": "19102-1234"
}''']
Loading

0 comments on commit 372851c

Please sign in to comment.