Pulp import export support#455
Conversation
| PULP_ALLOWED_IMPORT_PATHS: >- | ||
| {{ pulp_default_import_path + pulp_extra_import_paths }} | ||
| PULP_ALLOWED_EXPORT_PATHS: >- | ||
| {{ pulp_default_export_path + pulp_extra_export_paths }} |
There was a problem hiding this comment.
Locally I have this:
PULP_ALLOWED_IMPORT_PATHS: >-
['/var/lib/pulp/sync_imports', '/var/lib/pulp/imports']
PULP_ALLOWED_EXPORT_PATHS: >-
['/var/lib/pulp/exports']
These would be the default paths..
|
Can we make these import/export arguments also available via |
Consider this method for defining them -- https://github.com/theforeman/foremanctl/blob/master/docs/developer/playbooks-and-roles.md#shared-metadata-fragments |
|
I just tried this out, seeing the following in my pulp-api service definition: So far so good, assuming the escaping is correct. And yes, I like to be able to import from my export directory. |
|
Export and import worked! I was able to generate |
|
@ehelms I am not too sure on how to make sure the created import and export directories are mounted into the container. Can you point me into the right direction. Maybe somewhere in the code we handle a similar workflow |
You'll need to do something like this -- https://github.com/theforeman/foremanctl/blob/master/src/roles/pulp/tasks/main.yaml#L137 |
| pulp_volumes: >- | ||
| {{ | ||
| ['/var/lib/pulp:/var/lib/pulp'] + | ||
| (pulp_import_paths | map('regex_replace', '^(.+)$', '\1:\1') | list) + |
There was a problem hiding this comment.
lets take one item from pulp_import_paths and call it string1, so string1="/foo/bar"
this regex turns string1 into the same format as the line above. ('/var/lib/pulp:/var/lib/pulp').
So after string1 runs through regex, we get "/foo/bar:/foo:bar"
There was a problem hiding this comment.
As /var/lib/pulp is already mounted as a volume, do we want / need to mount the default paths? I realize this can make the logic a bit more complicated but I worry about performance of mounting unnecessary volumes, especially those that are sub-directories of an existing mount.
| foreman_development_github_username: | ||
| help: GitHub username to add as additional remote for git checkouts | ||
| action: store | ||
| pulp_import_paths: |
There was a problem hiding this comment.
You could define these in a file like https://github.com/theforeman/foremanctl/blob/master/src/playbooks/_database_connection/metadata.obsah.yaml and then include that file in both deploy and deploy-dev.
| pulp_volumes: >- | ||
| {{ | ||
| ['/var/lib/pulp:/var/lib/pulp'] + | ||
| ((pulp_default_import_paths + pulp_import_paths) | map('regex_replace', '^(.+)$', '\1:\1') | list) + |
There was a problem hiding this comment.
| ((pulp_default_import_paths + pulp_import_paths) | map('regex_replace', '^(.+)$', '\1:\1') | list) + | |
| ((pulp_import_paths) | map('regex_replace', '^(.+)$', '\1:\1') | list) + |
I think this would be the way to prevent known double-mounting? Same for line below.
There was a problem hiding this comment.
Okay I will make this change today
There was a problem hiding this comment.
Okay pushed that change with some test changes as well
| assert server.file(path).is_directory | ||
|
|
||
| @pytest.mark.parametrize("container", ["pulp-api", "pulp-content", "pulp-worker-1"]) | ||
| def test_pulp_import_export_volume_mounts(server, container, pulp_import_export_paths): |
There was a problem hiding this comment.
My read on this is that it will check only the defaults right now, since neither the tests or the test setup is specifying any additional paths. Have you thought about that and adding specification of additional paths to the test setup?
There was a problem hiding this comment.
It will also read custom paths as well the fixture will pull items from the environment and verify that any path in the PULP_ALLOWED_IMPORT_PATHS or PULP_ALLOWED_EXPORT_PATHS is present AND a volume mount.
Why are you introducing these changes? (Problem description, related links)
Jira
Add pulp content import/export arguments.
What are the changes introduced in this pull request?
You can pass in multiple args of either
--content-import-pathor--content-export-pathas many times as you want, since these will be appended as a list. These folders will be automatically created.How to test this pull request
pytest tests/pulp_test.pyCan also manually test these steps.