Tatiana Tereshchenko
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Notes Jan 19 2022 Show how to generate a graphic representation of db schema * [ggainey](https://) AI to figure out if we can use the tool on RHEL7 * https://django-extensions.readthedocs.io/en/latest/graph_models.html * [py-graphiz available on RHEL7](https://access.redhat.com/downloads/content/graphviz-python/2.30.1-22.el7/x86_64/fd431d51/package) * django-extensions does **NOT** appear to be available as RPMs for RHEL - need to pip-install :( * https://hackmd.io/@pulp/pulp3_and_graphviz * Explain relationships for content * https://docs.pulpproject.org/pulpcore/concepts.html * Artifact, Content, ContentArtifact, Repository, RepositoryVersion * Provide list of handy REST API calls * List of SQL queries that are useful * Explain why artifacts are named how they are named. Content addresable storage. Pulp's need to support more than filesystem storage. * Currently not possible to export a repository to a filesystem. * Pulp2 Way involved a bajillion symlinks, and is the primary reason publish was So Damn Slow * Provide an explanation for when you need to resync a capsule because the layout of the repository on the main satellite changed. * RFE for tasks by worker * Explain that all the sync optimizations are the same for capsules and main sat. * Explain PULP_CONTENT_PREMIGRATION_BATCH_SIZE=1000 - maybe update docs? * Recipe for tricking pulp into redownloading an RPM. # Digging into Pulp 3 internals To get Pulp 3 configuration run `dynaconf list`. In Katello environment: `sudo -u pulp PULP_SETTINGS='/etc/pulp/settings.py' DJANGO_SETTINGS_MODULE='pulpcore.app.settings' dynaconf list` ### How to get RPM repository metadata * download from the distributed version * CONTENT_ORIGIN (e.g. `http://pulp.example.com/`) is where all the content, including repositories are served. * Repositories are served at CONTENT_PATH_PREFIX, which is usually `/pulp/content/`. * Download the repodata of interest, e.g. `wget http://pulp.example.com/pulp/content/<your_repo_base_path>/repodata/<metadata_of_your_interest>` * find on the disk * get the path using pulpcore-manager ``` >>> from pulp_rpm.app.models.repository import RpmDistribution, RpmPublication >>> from pulpcore.app.models.repository import RepositoryVersion # [best option] if the repo base path is known (whatever goes after /pulp/content/ to the root of a repository) # here the base path is 'centos8ha', and the metadata of interest is 'updateinfo'. >>> RpmDistribution.objects.get(base_path='centos8ha').publication.published_metadata.get(relative_path__contains='updateinfo').contentartifact_set.first().artifact.file.path '/var/lib/pulp/artifact/8b/7fdc80cb0303305933f5d7d57520200f90f787ea3650f2c7e62511a4b16358' # if a publication uuid is known >>> RpmPublication.objects.get(pulp_id='a7996954-79fa-4334-a8a5-9fba0c2560cc').published_metadata.get(relative_path__contains='updateinfo').contentartifact_set.first().artifact.file.path '/var/lib/pulp/artifact/8b/7fdc80cb0303305933f5d7d57520200f90f787ea3650f2c7e62511a4b16358' # if a repository uuid and repository version number are known >>> RepositoryVersion.objects.get(repository='88835194-54a7-4af4-a062-6f572edeec0b', number=1, complete=True).publication_set.first().published_metadata.get(relative_path__contains='updateinfo').contentartifact_set.first().artifact.file.path '/var/lib/pulp/artifact/8b/7fdc80cb0303305933f5d7d57520200f90f787ea3650f2c7e62511a4b16358' ``` * get the path directly from the database ``` # The case when a base path is known. # I'll show in multiple steps for better readability. Feel free to combine into N joins or nested queries. pulp=> SELECT rpm_rpmdistribution.publication_id FROM rpm_rpmdistribution INNER JOIN core_basedistribution ON (rpm_rpmdistribution.basedistribution_ptr_id = core_basedistribution.pulp_id) WHERE core_basedistribution.base_path = 'centos8ha'; publication_id -------------------------------------- a7996954-79fa-4334-a8a5-9fba0c2560cc (1 row) # published metadata is also considered content at the db level pulp=> SELECT core_content.pulp_id as published_metadata_content_id FROM core_publishedmetadata INNER JOIN core_content ON (core_publishedmetadata.content_ptr_id = core_content.pulp_id) WHERE core_publishedmetadata.publication_id = 'a7996954-79fa-4334-a8a5-9fba0c2560cc' AND core_publishedmetadata.relative_path LIKE '%updateinfo%'; published_metadata_content_id -------------------------------------- 792b19da-1952-408f-904e-69715e48b533 (1 row) pulp=> SELECT core_artifact.file FROM core_contentartifact INNER JOIN core_artifact ON (core_contentartifact.artifact_id = core_artifact.pulp_id) WHERE core_contentartifact.content_id = '792b19da-1952-408f-904e-69715e48b533'; file ---------------------------------------------------------------------------- artifact/8b/7fdc80cb0303305933f5d7d57520200f90f787ea3650f2c7e62511a4b16358 (1 row) ``` The path is relative to the MEDIA_ROOT, usually, '/var/lib/pulp' or /var/lib/pulp/media. Keep in mind, that storage is not alwayd local, it can be S3 or Azure storage or something else. But for Katello installations, it should be only local, as of now. ### How to find/check by filename or NEVRA if an RPM is on the disk * by filename * get the path using pulpcore-manager ``` >>> from pulpcore.app.models.content import ContentArtifact >>> ContentArtifact.objects.get(relative_path__contains='lion-0.4-1.noarch.rpm').artifact.file.path '/var/lib/pulp/artifact/72/dd5d133a14e7ca371839f069714a2a44c90c2001d605321fd9e6e7b99ca023' ``` * get the path directly from the database relying on the expected filename ``` # If artifact_id is not present, it means that the package is not expected to be on the disk and likely is the on_demand content unit pulp=> select artifact_id from core_contentartifact where relative_path like '%lion-0.4-1.noarch.rpm'; artifact_id -------------------------------------- 0bc23639-b202-49a1-a1fe-5d4d9529c119 (1 row) # If the artifact id is present, then it is possible to check where pulp=> select file from core_artifact where pulp_id='0bc23639-b202-49a1-a1fe-5d4d9529c119'; file ---------------------------------------------------------------------------- artifact/72/dd5d133a14e7ca371839f069714a2a44c90c2001d605321fd9e6e7b99ca023 (1 row) ``` * by NEVRA or any other RPM metadata, preferably by the checksum If RPMs are downloaded you can always get their sha256 checksum and form a path. ``` sha256: 72dd5d133a14e7ca371839f069714a2a44c90c2001d605321fd9e6e7b99ca023 path: artifact/72/dd5d133a14e7ca371839f069714a2a44c90c2001d605321fd9e6e7b99ca023 ``` * using pulpcore-manager ``` # you can ask for any checksum type available to you, the best option is sha256 >>> from pulp_rpm.app.models.package import Package >>> Package.objects.get(name='lion', epoch='0', version='0.4', release='1', arch='noarch', checksum_type='sha256').pkgId '72dd5d133a14e7ca371839f069714a2a44c90c2001d605321fd9e6e7b99ca023' # if you have other checksum type than sha256, search the artifact by that checksum >>> from pulpcore.app.models.content import Artifact >>> Artifact.objects.get(sha1='<your sha1 checksum>').file.path '/var/lib/pulp/artifact/72/dd5d133a14e7ca371839f069714a2a44c90c2001d605321fd9e6e7b99ca023' ``` * directly in the database ``` # you can ask for any checksum type available to you, the best option is sha256 pulp=> select "pkgId" from rpm_package where name='lion' and epoch='0' and version='0.4' and release='1' and arch='noarch' and checksum_type='sha256'; pkgId ------------------------------------------------------------------ 72dd5d133a14e7ca371839f069714a2a44c90c2001d605321fd9e6e7b99ca023 (1 row) # if you have other checksum type than sha256, search the artifact by that checksum pulp=> select file from core_artifact where sha1='<your sha1 checksum>'; file ---------------------------------------------------------------------------- artifact/72/dd5d133a14e7ca371839f069714a2a44c90c2001d605321fd9e6e7b99ca023 (1 row) ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully