Skip to content

Commit f6a4722

Browse files
committed
sanity: fix issues found by ansible-test sanity
1 parent 3d2aa0d commit f6a4722

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

plugins/modules/pulp_container_content.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/python
22
# -*- coding: utf-8 -*-
33

4+
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
5+
46
from __future__ import absolute_import, division, print_function
57

68
__metaclass__ = type
@@ -32,12 +34,25 @@
3234
- Name of the repository to add or remove content
3335
type: str
3436
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
3545
tags:
3646
description:
3747
- List of tags to add or remove
3848
type: list
39-
items: str
49+
elements: str
4050
required: true
51+
wait:
52+
description:
53+
- Whether to wait for completion of the operation
54+
type: bool
55+
default: true
4156
extends_documentation_fragment:
4257
- pulp.squeezer.pulp
4358
- pulp.squeezer.pulp.entity_state
@@ -79,7 +94,6 @@
7994
from ansible_collections.pulp.squeezer.plugins.module_utils.pulp import (
8095
PAGE_LIMIT,
8196
PulpContainerRepository,
82-
PulpEntity,
8397
PulpEntityAnsibleModule,
8498
PulpTask,
8599
SqueezerException,
@@ -123,8 +137,8 @@ def get_content_units(self, repo):
123137
offset += PAGE_LIMIT
124138

125139
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"])):
128142
missing = ", ".join(set(self.module.params["tags"]) - set(tags))
129143
raise SqueezerException(f"Some tags not found in source repository: {missing}")
130144
return [result["pulp_href"] for result in tags]
@@ -180,8 +194,8 @@ def main():
180194
repository={"required": True},
181195
src_repo={},
182196
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},
185199
wait={"type": "bool", "default": True},
186200
),
187201
required_if=[("state", "present", ["src_repo"])],

tests/pulp-in-one.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/bash -eu
22

33
# Run a Pulp in one container, and reset the admin password to 'password'.
44
# Use only for testing!
@@ -23,7 +23,7 @@ docker run \
2323
--name pulp \
2424
--volume "$(pwd)/settings":/etc/pulp \
2525
--publish 8080:80 \
26-
pulp/pulp:$PULP_TAG
26+
pulp/pulp:"$PULP_TAG"
2727

2828
# Wait for it to come up.
2929
attempts=0

0 commit comments

Comments
 (0)