Skip to content
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
9 changes: 6 additions & 3 deletions extensions_admin/pulp_python/extensions/admin/cudl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

d = _('if "true", on each successful sync the repository will automatically be '
'published; if "false" content will only be available after manually publishing '
'the repository; defaults to "false"')
'the repository; defaults to "true"')
OPT_AUTO_PUBLISH = PulpCliOption('--auto-publish', d, required=False,
parse_func=parsers.parse_boolean)
d = _('a comma separated list of package names you wish Pulp to sync')
Expand Down Expand Up @@ -57,7 +57,11 @@ def _describe_distributors(self, user_input):
:rtype: list of dict
"""
config = {}
auto_publish = user_input.get('auto-publish', True)
auto_publish = user_input.get(OPT_AUTO_PUBLISH.keyword)

if auto_publish is None:
auto_publish = True

data = [
dict(distributor_type_id=constants.DISTRIBUTOR_TYPE_ID,
distributor_config=config,
Expand Down Expand Up @@ -141,7 +145,6 @@ def run(self, **kwargs):

# Update distributor configuration
web_config = {}

value = kwargs.pop(OPT_AUTO_PUBLISH.keyword, None)
if value is not None:
web_config['auto_publish'] = value
Expand Down
5 changes: 4 additions & 1 deletion extensions_admin/test/unit/admin/test_cudl.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ def test___init__(self):

def test_describe_distributors(self):
command = TestPythonRespositoryOptions.MixinTestClass()
user_input = {}
# by default the value is set to None
user_input = {
'auto-publish': None
}
result = command._describe_distributors(user_input)
target_result = {'distributor_id': constants.CLI_DISTRIBUTOR_ID,
'distributor_type_id': constants.DISTRIBUTOR_TYPE_ID,
Expand Down