collection 교체

This commit is contained in:
정훈 변
2024-02-23 16:37:40 +09:00
parent b494779b5b
commit 3fd554eee9
38862 changed files with 220204 additions and 6600073 deletions

View File

@@ -1,9 +1,10 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Patrik Lundin <patrik@sigterm.se>
# Copyright (c) 2013, Patrik Lundin <patrik@sigterm.se>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import absolute_import, division, print_function
__metaclass__ = type
@@ -13,24 +14,29 @@ DOCUMENTATION = '''
---
module: openbsd_pkg
author:
- Patrik Lundin (@eest)
- Patrik Lundin (@eest)
short_description: Manage packages on OpenBSD
description:
- Manage packages on OpenBSD using the pkg tools.
requirements:
- python >= 2.5
- Manage packages on OpenBSD using the pkg tools.
extends_documentation_fragment:
- community.general.attributes
attributes:
check_mode:
support: full
diff_mode:
support: none
options:
name:
description:
- A name or a list of names of the packages.
required: yes
required: true
type: list
elements: str
state:
description:
- C(present) will make sure the package is installed.
C(latest) will make sure the latest version of the package is installed.
C(absent) will make sure the specified package is not installed.
- V(present) will make sure the package is installed.
- V(latest) will make sure the latest version of the package is installed.
- V(absent) will make sure the specified package is not installed.
choices: [ absent, latest, present, installed, removed ]
default: present
type: str
@@ -40,19 +46,19 @@ options:
a binary. Requires that the port source tree is already installed.
Automatically builds and installs the 'sqlports' package, if it is
not already installed.
- Mutually exclusive with I(snapshot).
- Mutually exclusive with O(snapshot).
type: bool
default: no
default: false
snapshot:
description:
- Force C(%c) and C(%m) to expand to C(snapshots), even on a release kernel.
- Mutually exclusive with I(build).
- Mutually exclusive with O(build).
type: bool
default: no
default: false
version_added: 1.3.0
ports_dir:
description:
- When used in combination with the C(build) option, allows overriding
- When used in combination with the O(build) option, allows overriding
the default ports source directory.
default: /usr/ports
type: path
@@ -62,16 +68,16 @@ options:
file(s) in the old packages which are annotated with @extra in
the packaging-list.
type: bool
default: no
default: false
quick:
description:
- Replace or delete packages quickly; do not bother with checksums
before removing normal files.
type: bool
default: no
default: false
notes:
- When used with a `loop:` each package will be processed individually,
it is much more efficient to pass the list directly to the `name` option.
- When used with a C(loop:) each package will be processed individually,
it is much more efficient to pass the list directly to the O(name) option.
'''
EXAMPLES = '''
@@ -94,7 +100,7 @@ EXAMPLES = '''
community.general.openbsd_pkg:
name: nmap
state: present
build: yes
build: true
- name: Specify a pkg flavour with '--'
community.general.openbsd_pkg:
@@ -119,13 +125,13 @@ EXAMPLES = '''
- name: Purge a package and it's configuration files
community.general.openbsd_pkg:
name: mpd
clean: yes
clean: true
state: absent
- name: Quickly remove a package without checking checksums
community.general.openbsd_pkg:
name: qt5
quick: yes
quick: true
state: absent
'''
@@ -146,7 +152,11 @@ def execute_command(cmd, module):
# This makes run_command() use shell=False which we need to not cause shell
# expansion of special characters like '*'.
cmd_args = shlex.split(cmd)
return module.run_command(cmd_args)
# We set TERM to 'dumb' to keep pkg_add happy if the machine running
# ansible is using a TERM that the managed machine does not know about,
# e.g.: "No progress meter: failed termcap lookup on xterm-kitty".
return module.run_command(cmd_args, environ_update={'TERM': 'dumb'})
# Function used to find out if a package is currently installed.
@@ -159,7 +169,11 @@ def get_package_state(names, pkg_spec, module):
rc, stdout, stderr = execute_command(command, module)
if stderr:
module.fail_json(msg="failed in get_package_state(): " + stderr)
match = re.search(r"^Can't find inst:%s$" % re.escape(name), stderr)
if match:
pkg_spec[name]['installed_state'] = False
else:
module.fail_json(msg="failed in get_package_state(): " + stderr)
if stdout:
# If the requested package name is just a stem, like "python", we may