|
1 | 1 | #!/usr/bin/python
|
2 | 2 | # -*- coding: utf-8 -*-
|
3 | 3 |
|
| 4 | +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 5 | + |
4 | 6 | from __future__ import absolute_import, division, print_function
|
5 | 7 |
|
6 | 8 | __metaclass__ = type
|
|
32 | 34 | - Name of the repository to add or remove content
|
33 | 35 | type: str
|
34 | 36 | required: true
|
| 37 | + state: |
| 38 | + description: |
| 39 | + - State the entity should be in |
| 40 | + type: str |
| 41 | + default: present |
| 42 | + choices: |
| 43 | + - present |
| 44 | + - absent |
35 | 45 | tags:
|
36 | 46 | description:
|
37 | 47 | - List of tags to add or remove
|
38 | 48 | type: list
|
39 |
| - items: str |
| 49 | + elements: str |
40 | 50 | required: true
|
| 51 | + wait: |
| 52 | + description: |
| 53 | + - Whether to wait for completion of the operation |
| 54 | + type: bool |
| 55 | + default: true |
41 | 56 | extends_documentation_fragment:
|
42 | 57 | - pulp.squeezer.pulp
|
43 | 58 | - pulp.squeezer.pulp.entity_state
|
|
79 | 94 | from ansible_collections.pulp.squeezer.plugins.module_utils.pulp import (
|
80 | 95 | PAGE_LIMIT,
|
81 | 96 | PulpContainerRepository,
|
82 |
| - PulpEntity, |
83 | 97 | PulpEntityAnsibleModule,
|
84 | 98 | PulpTask,
|
85 | 99 | SqueezerException,
|
@@ -123,8 +137,8 @@ def get_content_units(self, repo):
|
123 | 137 | offset += PAGE_LIMIT
|
124 | 138 |
|
125 | 139 | if (self.module.params["state"] == "present" and
|
126 |
| - not self.module.params["allow_missing"] and |
127 |
| - len(tags) != len(self.module.params["tags"])): |
| 140 | + not self.module.params["allow_missing"] and |
| 141 | + len(tags) != len(self.module.params["tags"])): |
128 | 142 | missing = ", ".join(set(self.module.params["tags"]) - set(tags))
|
129 | 143 | raise SqueezerException(f"Some tags not found in source repository: {missing}")
|
130 | 144 | return [result["pulp_href"] for result in tags]
|
@@ -180,8 +194,8 @@ def main():
|
180 | 194 | repository={"required": True},
|
181 | 195 | src_repo={},
|
182 | 196 | src_is_push={"type": "bool", "default": False},
|
183 |
| - state={"default": "present"}, |
184 |
| - tags={"type": "list", "item": "str", "required": True}, |
| 197 | + state={"default": "present", "choices": ["present", "absent"]}, |
| 198 | + tags={"type": "list", "elements": "str", "required": True}, |
185 | 199 | wait={"type": "bool", "default": True},
|
186 | 200 | ),
|
187 | 201 | required_if=[("state", "present", ["src_repo"])],
|
|
0 commit comments