Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup tox.ini and GHA #439

Merged
merged 11 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
profile: production

exclude_paths:
- tests/integration
- tests/sanity
- modules.yaml

skip_list:
- yaml[indentation]
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: CI
name: Changelog

concurrency:
group: '${{ github.workflow }} @ ${{ github.sha }}'
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/linters.yml → .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: Linters
concurrency:
group: ${{ github.head_ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
types:
- opened
- reopened
- labeled
- unlabeled
- synchronize
branches:
- main
Expand All @@ -20,3 +18,10 @@ on:
jobs:
linters:
uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main
ansible-lint:
runs-on: ubuntu-latest
steps:
- uses: ansible-network/github_actions/.github/actions/checkout_dependency@main

- name: Run ansible-lint
uses: ansible/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# it has to adhere to Python compatibility and CI testing requirements described in
# https://docs.ansible.com/ansible/latest/community/collection_contributors/collection_requirements.html.

name: CI
name: Sanity tests
on:
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
push:
Expand Down Expand Up @@ -75,12 +75,11 @@ jobs:
# Add new versions announced in
# https://github.com/ansible-collections/news-for-maintainers in a timely manner,
# consider dropping testing against EOL versions and versions you don't support.
- stable-2.13
- stable-2.14
- stable-2.15
# - stable-2.16
# - devel
# - milestone
- stable-2.16
# - devel
# - milestone
# Ansible-test on various stable branches does not yet work well with cgroups v2.
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
# image for these stable branches. The list of branches where this is necessary will
Expand Down
6 changes: 6 additions & 0 deletions changelogs/fragments/gha_cleanup_version_update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
breaking_changes:
- "Remove support for ansible-core < 2.14"
trivial:
- "Organize GitHub workflows"
- "ansible-lint and isort fixes"
18 changes: 9 additions & 9 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
namespace: vmware
name: vmware_rest
readme: README.md
version: null
version: 3.0.0
authors:
- Ansible (https://github.com/ansible)
description:
license:
- Ansible (https://github.com/ansible)
description: VMware collection for Ansible
license_file: LICENSE
tags:
- cloud
- vmware
- virtualization
- cloud
- vmware
- virtualization
dependencies:
cloud.common: '>=2.0.4,<3.0.0'
cloud.common: ">=2.0.4,<3.0.0"
repository: https://github.com/ansible-collections/vmware.vmware_rest.git
homepage: https://github.com/ansible-collections/vmware.vmware_rest
issues: https://github.com/ansible-collections/vmware.vmware_rest/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc
build_ignore:
- 'config/*'
- config/*
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
requires_ansible: '>=2.9.10'
requires_ansible: ">=2.14.0"
12 changes: 6 additions & 6 deletions plugins/lookup/cluster_moid.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
- name: set connection info
ansible.builtin.set_fact:
connection_args:
vcenter_hostname: "vcenter.test"
vcenter_username: "[email protected]"
vcenter_password: "1234"
vcenter_hostname: "vcenter.test"
vcenter_username: "[email protected]"
vcenter_password: "1234"

- name: lookup MoID of the object
ansible.builtin.debug: msg="{{ lookup('vmware.vmware_rest.cluster_moid', '/my_dc/host/my_cluster', **connection_args) }}"
Expand All @@ -49,13 +49,13 @@
"""


from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)
from ansible_collections.vmware.vmware_rest.plugins.plugin_utils.lookup import (
Lookup,
get_credentials,
)
from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)


class LookupModule(LookupBase):
Expand Down
6 changes: 3 additions & 3 deletions plugins/lookup/datacenter_moid.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
"""


from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)
from ansible_collections.vmware.vmware_rest.plugins.plugin_utils.lookup import (
Lookup,
get_credentials,
)
from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)


class LookupModule(LookupBase):
Expand Down
6 changes: 3 additions & 3 deletions plugins/lookup/datastore_moid.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
"""


from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)
from ansible_collections.vmware.vmware_rest.plugins.plugin_utils.lookup import (
Lookup,
get_credentials,
)
from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)


class LookupModule(LookupBase):
Expand Down
6 changes: 3 additions & 3 deletions plugins/lookup/folder_moid.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
"""


from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)
from ansible_collections.vmware.vmware_rest.plugins.plugin_utils.lookup import (
Lookup,
get_credentials,
)
from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)


class LookupModule(LookupBase):
Expand Down
6 changes: 3 additions & 3 deletions plugins/lookup/host_moid.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
"""


from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)
from ansible_collections.vmware.vmware_rest.plugins.plugin_utils.lookup import (
Lookup,
get_credentials,
)
from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)


class LookupModule(LookupBase):
Expand Down
6 changes: 3 additions & 3 deletions plugins/lookup/network_moid.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
"""


from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)
from ansible_collections.vmware.vmware_rest.plugins.plugin_utils.lookup import (
Lookup,
get_credentials,
)
from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)


class LookupModule(LookupBase):
Expand Down
6 changes: 3 additions & 3 deletions plugins/lookup/resource_pool_moid.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
"""


from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)
from ansible_collections.vmware.vmware_rest.plugins.plugin_utils.lookup import (
Lookup,
get_credentials,
)
from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)


class LookupModule(LookupBase):
Expand Down
6 changes: 3 additions & 3 deletions plugins/lookup/vm_moid.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
"""


from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)
from ansible_collections.vmware.vmware_rest.plugins.plugin_utils.lookup import (
Lookup,
get_credentials,
)
from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
TurboLookupBase as LookupBase,
)


class LookupModule(LookupBase):
Expand Down
3 changes: 1 addition & 2 deletions plugins/module_utils/vmware_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import importlib
import json
import re

import urllib.parse

from ansible.module_utils.basic import missing_required_lib
Expand Down Expand Up @@ -271,7 +270,7 @@ async def update_changed_flag(data, status, operation):


async def list_devices(session, url):
existing_entries = []
pass
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems unnecessary, I would suggest removing this. if we need to make changes to the generator to do that I'd be ok with merging this for now as it should be harmless and doing that under a separate PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jillr I don't think this file is generated. At least, when I generate code with ansible.content_builder (for example here: #441) I don't see it. But I may be wrong... I'm still learning and might have make a mistake somewhere.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might not be - I'm more familiar with the generated amazon collection and some of those module_utils lived in an early version of that generator, so calling it out just in case!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jillr It's already a very big PR with a lot of changes. I suggest to keep it like this and have a closer look at this later ;-)


async with session.get(url) as resp:
_json = await resp.json()
Expand Down
12 changes: 8 additions & 4 deletions plugins/modules/appliance_access_consolecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,29 @@
AnsibleModule.collection_name = "vmware.vmware_rest"
except ImportError:
from ansible.module_utils.basic import AnsibleModule

from ansible_collections.vmware.vmware_rest.plugins.module_utils.vmware_rest import (
exists,
gen_args,
get_subdevice_type,
open_session,
prepare_payload,
update_changed_flag,
session_timeout,
update_changed_flag,
)


def prepare_argument_spec():
argument_spec = {
"vcenter_hostname": dict(
type="str", required=True, fallback=(env_fallback, ["VMWARE_HOST"]),
type="str",
required=True,
fallback=(env_fallback, ["VMWARE_HOST"]),
),
"vcenter_username": dict(
type="str", required=True, fallback=(env_fallback, ["VMWARE_USER"]),
type="str",
required=True,
fallback=(env_fallback, ["VMWARE_USER"]),
),
"vcenter_password": dict(
type="str",
Expand Down Expand Up @@ -199,7 +204,6 @@ def build_url(params):


async def entry_point(module, session):

if module.params["state"] == "present":
if "_create" in globals():
operation = "create"
Expand Down
11 changes: 8 additions & 3 deletions plugins/modules/appliance_access_consolecli_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,26 @@
AnsibleModule.collection_name = "vmware.vmware_rest"
except ImportError:
from ansible.module_utils.basic import AnsibleModule

from ansible_collections.vmware.vmware_rest.plugins.module_utils.vmware_rest import (
gen_args,
open_session,
update_changed_flag,
session_timeout,
update_changed_flag,
)


def prepare_argument_spec():
argument_spec = {
"vcenter_hostname": dict(
type="str", required=True, fallback=(env_fallback, ["VMWARE_HOST"]),
type="str",
required=True,
fallback=(env_fallback, ["VMWARE_HOST"]),
),
"vcenter_username": dict(
type="str", required=True, fallback=(env_fallback, ["VMWARE_USER"]),
type="str",
required=True,
fallback=(env_fallback, ["VMWARE_USER"]),
),
"vcenter_password": dict(
type="str",
Expand Down
12 changes: 8 additions & 4 deletions plugins/modules/appliance_access_dcui.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,29 @@
AnsibleModule.collection_name = "vmware.vmware_rest"
except ImportError:
from ansible.module_utils.basic import AnsibleModule

from ansible_collections.vmware.vmware_rest.plugins.module_utils.vmware_rest import (
exists,
gen_args,
get_subdevice_type,
open_session,
prepare_payload,
update_changed_flag,
session_timeout,
update_changed_flag,
)


def prepare_argument_spec():
argument_spec = {
"vcenter_hostname": dict(
type="str", required=True, fallback=(env_fallback, ["VMWARE_HOST"]),
type="str",
required=True,
fallback=(env_fallback, ["VMWARE_HOST"]),
),
"vcenter_username": dict(
type="str", required=True, fallback=(env_fallback, ["VMWARE_USER"]),
type="str",
required=True,
fallback=(env_fallback, ["VMWARE_USER"]),
),
"vcenter_password": dict(
type="str",
Expand Down Expand Up @@ -197,7 +202,6 @@ def build_url(params):


async def entry_point(module, session):

if module.params["state"] == "present":
if "_create" in globals():
operation = "create"
Expand Down
Loading