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

add how to create metadata.json to content_export_library/repository/version #1717

Open
evgeni opened this issue Mar 11, 2024 · 2 comments
Open

Comments

@evgeni
Copy link
Member

evgeni commented Mar 11, 2024

SUMMARY

For an export to be usable, it needs a metadata.json (see content_export_info), but the examples do not mention that, or the info module at all, leaving users with unusable exports.

ISSUE TYPE
  • Feature Idea
@sayan3296
Copy link

To add on, In case the format is syncable, We need to generate listing files in the exported content. When using hammer i.e.

hammer content-export complete library --organization-id 1 --format syncable

It takes care of the export and then does the generate-listing as well as generate-metadata action on that export but when using the redhat.satellite.content_export_* ansible modules [ or their foreman alternatives ], The listing files are not generated at all [ also the metadata file ].

metadata + listing files -> both needed when we want to import the data via hammer content-import
listing files only --> Needed when we want to copy the syncable export data in a webserver and use it as a Custom CDN to sync the data from.

@jtruestedt
Copy link

I also stumbled upon this missing metadata.json and found a way to generate it (with the content_export_info).
Just to add it as example to get the same output like when running hammer, it could look like this in ansible (in this case content view version export)

    - name: "Export content view"
      theforeman.foreman.content_export_version:
          username: "{{ foreman_username }}"
          password: "{{ foreman_password }}"
          server_url: "{{ foreman_server_url }}"
          organization: "{{ foreman_organization }}"
          validate_certs: "{{ foreman_validate_certs }}"
          content_view: "{{ foreman_content_view }}"
          content_view_version: "{{ foreman_content_view_version }}"
          incremental: "{{ foreman_incremental }}"
          fail_on_missing_content: True
          format: importable

    - name: "Export content view info"
      theforeman.foreman.content_export_info:
          username: "{{ foreman_username }}"
          password: "{{ foreman_password }}"
          server_url: "{{ foreman_server_url }}"
          organization: "{{ foreman_organization }}"
          validate_certs: "{{ foreman_validate_certs }}"
          content_view: "{{ foreman_content_view }}"
      register: result

    - name: "Write metadata.json to disk using data from the previous task"
      vars:
        metadata: "{{ result['content_exports'][-1]['metadata'] }}"
      ansible.builtin.copy:
        content: "{{ metadata }}"
        dest: "{{ result['content_exports'][-1]['path'] }}/metadata.json"

So combining the examples of the export and the export info should work - but it should be mentioned somewhere. But if someone else is looking for something that example might help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants