Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error is raised when running pulp domain in a container with two domains #862

Closed
lubosmj opened this issue Jan 12, 2024 · 8 comments
Closed
Labels
bug Something isn't working (template-set) Triage-Needed Needs to be reviewed at next pulp-cli mtg

Comments

@lubosmj
Copy link
Member

lubosmj commented Jan 12, 2024

$ pulp domain list
Traceback (most recent call last):
  File "/usr/local/bin/pulp", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/pulp_cli/__init__.py", line 33, in main
    return _main()
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/pulpcore/cli/common/generic.py", line 179, in invoke
    return super().invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1655, in invoke
    sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 920, in make_context
    self.parse_args(ctx, args)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1613, in parse_args
    rest = super().parse_args(ctx, args)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1378, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 2356, in handle_parse_result
    value, source = self.consume_value(ctx, opts)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 2890, in consume_value
    value, source = super().consume_value(ctx, opts)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 2247, in consume_value
    value = ctx.lookup_default(self.name)  # type: ignore
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 664, in lookup_default
    value = self.default_map.get(name)
AttributeError: 'str' object has no attribute 'get'

The command domains works as expected. However, this is not a recommended way of tampering with domains as the warning mentions.

$ pulp domains list
Please use 'domain' instead of 'domains'.
[
  {
    "pulp_href": "/pulp/default/api/v3/domains/018cfe55-95b6-7bb4-833f-a701971fa4cc/",
    "pulp_created": "2024-01-12T15:41:10.967249Z",
    "name": "domain_for_otel_testing",
    "description": null,
    "storage_class": "pulpcore.app.models.storage.FileSystem",
    "storage_settings": {
      "hidden_fields": [],
      "location": "/var/lib/pulp/media_otel/",
      "base_url": "",
      "file_permissions_mode": 420,
      "directory_permissions_mode": null
    },
    "redirect_to_object_storage": true,
    "hide_guarded_distributions": false
  },
  {
    "pulp_href": "/pulp/default/api/v3/domains/018cfdd1-51c8-7cdc-a654-be9fcab28460/",
    "pulp_created": "2024-01-12T13:16:42.825356Z",
    "name": "default",
    "description": null,
    "storage_class": "pulpcore.app.models.storage.FileSystem",
    "storage_settings": {
      "hidden_fields": [],
      "location": "/var/lib/pulp/media",
      "base_url": "/",
      "file_permissions_mode": 420,
      "directory_permissions_mode": null
    },
    "redirect_to_object_storage": true,
    "hide_guarded_distributions": false
  }
]

pulp3 command line interface, version 0.20.2

@lubosmj lubosmj added bug Something isn't working (template-set) Triage-Needed Needs to be reviewed at next pulp-cli mtg labels Jan 12, 2024
@mdellweg
Copy link
Member

Since when is default_map a string? What's going wrong there?

@lubosmj
Copy link
Member Author

lubosmj commented Jan 12, 2024

As I am thinking about it, is not the issue #769 related to this? I did not make any changes to the configuration. I just started a new oci-env container, shelled into it and ran pulp domain.

@mdellweg
Copy link
Member

As I am thinking about it, is not the issue #769 related to this? I did not make any changes to the configuration. I just started a new oci-env container, shelled into it and ran pulp domain.

Yes, that rings a bell. Do you specify "domain" in the settings?

@lubosmj
Copy link
Member Author

lubosmj commented Jan 12, 2024

Maybe, we should backport #772 to 0.20 since it comes pre-installed with oci-env.

@lubosmj
Copy link
Member Author

lubosmj commented Jan 12, 2024

Yes, there is "default" domain specified:

[cli]
base_url = "http://localhost:5001"
api_root = "/pulp/"
username = "admin"
password = "password"
domain = "default"
cert = ""
key = ""
verify_ssl = true
format = "json"
dry_run = false
timeout = 0
verbose = 0

@mdellweg
Copy link
Member

Maybe, we should backport #772 to 0.20 since it comes pre-installed with oci-env.

#863

Also why does it preinstall an old version?

@lubosmj
Copy link
Member Author

lubosmj commented Jan 13, 2024

@mdellweg
Copy link
Member

The fix has been backported now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working (template-set) Triage-Needed Needs to be reviewed at next pulp-cli mtg
Projects
No open projects
Archived in project
Development

No branches or pull requests

2 participants