Skip to content

Commit

Permalink
10.0.0: remove deprecated features (#8918)
Browse files Browse the repository at this point in the history
* Remove pool option from redhat_subscription.

* Remove proxmox_default_behavior option from proxmox_kvm.

* Remove the logging option from ejabberd_user.

* Remove the ack_params_state_absent option from consul.

* irc: change defaults of use_tls and validate_certs to true.

* rhsm_repository: remove states present and absent.

* Re-add 'using'.

* Fix typo.
  • Loading branch information
felixfontein authored Sep 28, 2024
1 parent 84e0190 commit fe18b05
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 368 deletions.
8 changes: 8 additions & 0 deletions changelogs/fragments/deprecations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
removed_features:
- "redhat_subscriptions - removed the ``pool`` option. Use ``pool_ids`` instead (https://github.com/ansible-collections/community.general/pull/8918)."
- "proxmox_kvm - removed the ``proxmox_default_behavior`` option. Explicitly specify the old default values if you were using ``proxmox_default_behavior=compatibility``, otherwise simply remove it (https://github.com/ansible-collections/community.general/pull/8918)."
- "ejabberd_user - removed the ``logging`` option (https://github.com/ansible-collections/community.general/pull/8918)."
- "consul - removed the ``ack_params_state_absent`` option. It had no effect anymore (https://github.com/ansible-collections/community.general/pull/8918)."
breaking_changes:
- "irc - the defaults of ``use_tls`` and ``validate_certs`` changed from ``false`` to ``true`` (https://github.com/ansible-collections/community.general/pull/8918)."
- "rhsm_repository - the states ``present`` and ``absent`` have been removed. Use ``enabled`` and ``disabled`` instead (https://github.com/ansible-collections/community.general/pull/8918)."
9 changes: 0 additions & 9 deletions plugins/modules/consul.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@
type: str
description:
- The token key identifying an ACL rule set. May be required to register services.
ack_params_state_absent:
type: bool
description:
- This parameter has no more effect and is deprecated. It will be removed in community.general 10.0.0.
'''

EXAMPLES = '''
Expand Down Expand Up @@ -598,11 +594,6 @@ def main():
timeout=dict(type='str'),
tags=dict(type='list', elements='str'),
token=dict(no_log=True),
ack_params_state_absent=dict(
type='bool',
removed_in_version='10.0.0',
removed_from_collection='community.general',
),
),
mutually_exclusive=[
('script', 'ttl', 'tcp', 'http'),
Expand Down
16 changes: 2 additions & 14 deletions plugins/modules/ejabberd_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@
description:
- the password to assign to the username
required: false
logging:
description:
- enables or disables the local syslog facility for this module
required: false
default: false
type: bool
state:
type: str
description:
Expand Down Expand Up @@ -75,8 +69,6 @@
state: absent
'''

import syslog

from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt

Expand All @@ -91,7 +83,6 @@ class EjabberdUser(object):

def __init__(self, module):
self.module = module
self.logging = module.params.get('logging')
self.state = module.params.get('state')
self.host = module.params.get('host')
self.user = module.params.get('username')
Expand Down Expand Up @@ -125,10 +116,8 @@ def exists(self):
return self.run_command('check_account', 'user host', (lambda rc, out, err: not bool(rc)))

def log(self, entry):
""" This method will log information to the local syslog facility """
if self.logging:
syslog.openlog('ansible-%s' % self.module._name)
syslog.syslog(syslog.LOG_NOTICE, entry)
""" This method does nothing """
pass

def run_command(self, cmd, options, process=None):
""" This method will run the any command specified and return the
Expand Down Expand Up @@ -169,7 +158,6 @@ def main():
username=dict(required=True, type='str'),
password=dict(type='str', no_log=True),
state=dict(default='present', choices=['present', 'absent']),
logging=dict(default=False, type='bool', removed_in_version='10.0.0', removed_from_collection='community.general'),
),
required_if=[
('state', 'present', ['password']),
Expand Down
33 changes: 6 additions & 27 deletions plugins/modules/irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@
was exlusively called O(use_ssl). The latter is now an alias of O(use_tls).
- B(Note:) for security reasons, you should always set O(use_tls=true) and
O(validate_certs=true) whenever possible.
- The option currently defaults to V(false). The default has been B(deprecated) and will
change to V(true) in community.general 10.0.0. To avoid deprecation warnings, explicitly
set this option to a value (preferably V(true)).
- The default of this option changed to V(true) in community.general 10.0.0.
type: bool
default: true
aliases:
- use_ssl
part:
Expand All @@ -110,10 +109,9 @@
if the network between between Ansible and the IRC server is known to be safe.
- B(Note:) for security reasons, you should always set O(use_tls=true) and
O(validate_certs=true) whenever possible.
- The option currently defaults to V(false). The default has been B(deprecated) and will
change to V(true) in community.general 10.0.0. To avoid deprecation warnings, explicitly
set this option to a value (preferably V(true)).
- The default of this option changed to V(true) in community.general 10.0.0.
type: bool
default: true
version_added: 8.1.0
# informational: requirements for nodes
Expand Down Expand Up @@ -313,8 +311,8 @@ def main():
passwd=dict(no_log=True),
timeout=dict(type='int', default=30),
part=dict(type='bool', default=True),
use_tls=dict(type='bool', aliases=['use_ssl']),
validate_certs=dict(type='bool'),
use_tls=dict(type='bool', default=True, aliases=['use_ssl']),
validate_certs=dict(type='bool', default=True),
),
supports_check_mode=True,
required_one_of=[['channel', 'nick_to']]
Expand All @@ -338,25 +336,6 @@ def main():
style = module.params["style"]
validate_certs = module.params["validate_certs"]

if use_tls is None:
module.deprecate(
'The default of use_tls will change to true in community.general 10.0.0.'
' Set a value now (preferably true, if possible) to avoid the deprecation warning.',
version='10.0.0',
collection_name='community.general',
)
use_tls = False

if validate_certs is None:
if use_tls:
module.deprecate(
'The default of validate_certs will change to true in community.general 10.0.0.'
' Set a value now (prefarably true, if possible) to avoid the deprecation warning.',
version='10.0.0',
collection_name='community.general',
)
validate_certs = False

try:
send_msg(msg, server, port, channel, nick_to, key, topic, nick, color, passwd, timeout, use_tls, validate_certs, part, style)
except Exception as e:
Expand Down
73 changes: 3 additions & 70 deletions plugins/modules/proxmox_kvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
short_description: Management of Qemu(KVM) Virtual Machines in Proxmox VE cluster
description:
- Allows you to create/delete/stop Qemu(KVM) Virtual Machines in Proxmox VE cluster.
- Since community.general 4.0.0 on, there are no more default values, see O(proxmox_default_behavior).
- Since community.general 4.0.0 on, there are no more default values.
author: "Abdoul Bah (@helldorado) <bahabdoul at gmail.com>"
attributes:
check_mode:
Expand All @@ -32,7 +32,6 @@
acpi:
description:
- Specify if ACPI should be enabled/disabled.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(true).
type: bool
agent:
description:
Expand All @@ -44,19 +43,15 @@
description:
- Pass arbitrary arguments to kvm.
- This option is for experts only!
- If O(proxmox_default_behavior) is set to V(compatibility), this option has a default of
V(-serial unix:/var/run/qemu-server/<vmid>.serial,server,nowait).
type: str
autostart:
description:
- Specify if the VM should be automatically restarted after crash (currently ignored in PVE API).
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(false).
type: bool
balloon:
description:
- Specify the amount of RAM for the VM in MB.
- Using zero disables the balloon driver.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(0).
type: int
bios:
description:
Expand All @@ -68,7 +63,6 @@
- Specify the boot order -> boot on floppy V(a), hard disk V(c), CD-ROM V(d), or network V(n).
- For newer versions of Proxmox VE, use a boot order like V(order=scsi0;net0;hostpci0).
- You can combine to set order.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(cnd).
type: str
bootdisk:
description:
Expand Down Expand Up @@ -104,12 +98,10 @@
cores:
description:
- Specify number of cores per socket.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(1).
type: int
cpu:
description:
- Specify emulated CPU type.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(kvm64).
type: str
cpulimit:
description:
Expand All @@ -120,7 +112,6 @@
description:
- Specify CPU weight for a VM.
- You can disable fair-scheduler configuration by setting this to 0
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(1000).
type: int
delete:
description:
Expand Down Expand Up @@ -173,7 +164,6 @@
description:
- Allow to force stop VM.
- Can be used with states V(stopped), V(restarted), and V(absent).
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(false).
- Requires parameter O(archive).
type: bool
format:
Expand All @@ -184,8 +174,7 @@
- Please refer to the Proxmox VE Administrator Guide, section Proxmox VE Storage (see
U(https://pve.proxmox.com/pve-docs/chapter-pvesm.html) for the latest version, tables 3 to 14) to find out format
supported by the provided storage backend.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(qcow2).
If O(proxmox_default_behavior) is set to V(no_defaults), not specifying this option is equivalent to setting it to V(unspecified).
- Not specifying this option is equivalent to setting it to V(unspecified).
type: str
choices: [ "cloop", "cow", "qcow", "qcow2", "qed", "raw", "vmdk", "unspecified" ]
freeze:
Expand Down Expand Up @@ -257,7 +246,6 @@
kvm:
description:
- Enable/disable KVM hardware virtualization.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(true).
type: bool
localtime:
description:
Expand All @@ -277,7 +265,6 @@
memory:
description:
- Memory size in MB for instance.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(512).
type: int
migrate:
description:
Expand Down Expand Up @@ -340,13 +327,11 @@
onboot:
description:
- Specifies whether a VM will be started during system bootup.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(true).
type: bool
ostype:
description:
- Specifies guest operating system. This is used to enable special optimization/features for specific operating systems.
- The l26 is Linux 2.6/3.X Kernel.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(l26).
type: str
choices: ['other', 'wxp', 'w2k', 'w2k3', 'w2k8', 'wvista', 'win7', 'win8', 'win10', 'win11', 'l24', 'l26', 'solaris']
parallel:
Expand Down Expand Up @@ -439,7 +424,6 @@
sockets:
description:
- Sets the number of CPU sockets. (1 - N).
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(1).
type: int
sshkeys:
description:
Expand Down Expand Up @@ -472,7 +456,6 @@
tablet:
description:
- Enables/disables the USB tablet device.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(false).
type: bool
tags:
description:
Expand All @@ -494,7 +477,6 @@
template:
description:
- Enables/disables the template.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(false).
type: bool
timeout:
description:
Expand Down Expand Up @@ -553,7 +535,6 @@
vga:
description:
- Select VGA type. If you want to use high resolution modes (>= 1280x1024x16) then you should use option 'std' or 'vmware'.
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(std).
type: str
choices: ['std', 'cirrus', 'vmware', 'qxl', 'serial0', 'serial1', 'serial2', 'serial3', 'qxl2', 'qxl3', 'qxl4']
virtio:
Expand All @@ -571,24 +552,6 @@
description:
- Creates a virtual hardware watchdog device.
type: str
proxmox_default_behavior:
description:
- As of community.general 4.0.0, various options no longer have default values.
These default values caused problems when users expected different behavior from Proxmox
by default or filled options which caused problems when set.
- The value V(compatibility) (default before community.general 4.0.0) will ensure that the default values
are used when the values are not explicitly specified by the user. The new default is V(no_defaults),
which makes sure these options have no defaults.
- This affects the O(acpi), O(autostart), O(balloon), O(boot), O(cores), O(cpu),
O(cpuunits), O(force), O(format), O(kvm), O(memory), O(onboot), O(ostype), O(sockets),
O(tablet), O(template), and O(vga) options.
- This option is deprecated and will be removed in community.general 10.0.0.
type: str
default: no_defaults
choices:
- compatibility
- no_defaults
version_added: "1.3.0"
seealso:
- module: community.general.proxmox_vm_info
extends_documentation_fragment:
Expand Down Expand Up @@ -1143,10 +1106,7 @@ def create_vm(self, vmid, newid, node, name, memory, cpu, cores, sockets, update
kwargs['tags'] = ",".join(kwargs['tags'])

# -args and skiplock require root@pam user - but can not use api tokens
if self.module.params['api_user'] == "root@pam" and self.module.params['args'] is None:
if not update and self.module.params['proxmox_default_behavior'] == 'compatibility':
kwargs['args'] = vm_args
elif self.module.params['api_user'] == "root@pam" and self.module.params['args'] is not None:
if self.module.params['api_user'] == "root@pam" and self.module.params['args'] is not None:
kwargs['args'] = self.module.params['args']
elif self.module.params['api_user'] != "root@pam" and self.module.params['args'] is not None:
self.module.fail_json(msg='args parameter require root@pam user. ')
Expand Down Expand Up @@ -1330,11 +1290,6 @@ def main():
virtio=dict(type='dict'),
vmid=dict(type='int'),
watchdog=dict(),
proxmox_default_behavior=dict(type='str',
default='no_defaults',
choices=['compatibility', 'no_defaults'],
removed_from_collection='community.general',
removed_in_version='10.0.0'),
)
module_args.update(kvm_args)

Expand Down Expand Up @@ -1363,28 +1318,6 @@ def main():
vmid = module.params['vmid']
validate_certs = module.params['validate_certs']

if module.params['proxmox_default_behavior'] == 'compatibility':
old_default_values = dict(
acpi=True,
autostart=False,
balloon=0,
boot='cnd',
cores=1,
cpu='kvm64',
cpuunits=1000,
format='qcow2',
kvm=True,
memory=512,
ostype='l26',
sockets=1,
tablet=False,
template=False,
vga='std',
)
for param, value in old_default_values.items():
if module.params[param] is None:
module.params[param] = value

if module.params['format'] == 'unspecified':
module.params['format'] = None

Expand Down
Loading

0 comments on commit fe18b05

Please sign in to comment.