Hammer publish with full sync

Hi all, currently running Foreman 3.15 with Katello 4.17 and have a cron on the master that runs a new sync across all products each month, followed by a content view (x3) publish the next day

Have noticed some content missing here and there and think it’s because each time we run the below cv publish, it runs an optimized sync, not full

#EL8
03 04 28 * * root hammer content-view publish --organization ‘Main’ --name ‘EL8’ --lifecycle-environments dev,prod --description “New EL8 content as of $(date ‘+%F’) for Monthly Patching” --async

I found this post: How to do same things as "Complete Sync" of smartproxy with hammer? as well as Fix wording on sync to Smart Proxy Server by maximiliankolb · Pull Request #2674 · theforeman/foreman-documentation · GitHub

It suggests I need to add either optimize=false or --skip-metadata-check true

Could someone help me tweak our cron to do so. I will then allow each CV an extra hour to complete before running the next one

Thank you

Anybody know how to enforce full sync when publishing a content view using hammer?

Hi @chatlow !

To force a complete sync on the repository itself use the --skip-metadata-check=true flag during repository sync when you call hammer repository synchronize in your cron. The complete sync has to be run before you publish a new version of the content view. The next publish will pick up the changes and publish a new version with the latest content on the repository. CV publish itself doesn’t have an optimized/complete option.

If you’re using a smart proxy as the linked post covers, the smart proxy sync also uses the --skip-metadata-check=true flag to force a complete sync.

Although if new content gets added to upstream repo, I’d expect an optimized sync on the repo to identify the change and fetch the new content. If you’re noticing content missing, you can check the task output of the relevant repository sync in the UI and see if the output contains a section called “Added content” listing the content you expect to see?

You may have hit the same issue as me with katello 4.17, some repositories are not available on the smart proxy until they are completely re-synced and no error is reported.

i should have added - I also run a sync before a few hours before the publish

Currently I have:

OEL8_Upstream

03 18 27 * * root hammer product synchronize --name “OEL8_Upstream” --organization-label Main --async

So you are saying to add " --skip-metadata-check=true" to this command and it trigger the full sync?

Also, do you know what --async is doing in both our product sync and publish commands. I copied it from here, prob should have questioned it at the time, but hasn’t caused any issues

many thanks

hmm thanks - the issue appears to be packages and newer content missing. Actual repos are showing up with dnf repolist all and are enabled too

One more remark: with OEL8 repositories, I always do full sync with skip-metadata-check=true because of some problems with metadata in the past.

thanks - good to know - so it would be:
03 18 27 * * root hammer product synchronize --name “OEL8_Upstream” --organization-label Main --async --skip-metadata-check=true to start a full sync? The publish as normal

Without --async hammer will show a progress bar for the task. With --async it returns to the command line.

Just noticed you’re calling sync on the product. Product sync doesn’t support the --skip-metadata-check and all syncs on product level will be optimized. Complete sync is only available on a repository level so you’ll need to update your sync to hammer repository synchronize ...

I do believe this is a functionality gap with product syncs and complete syncs should be allowed on a product level. This would be a valid RFE.

1 Like

Ah, I wasn’t aware of this, thanks. We have only 3 products but MANY repos within them. Can I issue hammer repository synchronize with a wildcard, such as OEL8-* ? Otherwise I’ll have to copy the command over 20 times for each repo sync :grimacing:

No wildcards, but lots of people use Bash scripting to iterate over items.

I’ve just released you are on about initial product/reps sync. This isn’t my issue as that appears to work well using part 1 of my cron (03 18 27 * * root hammer product synchronize --name “OEL8_Upstream” --organization-label Main --async)

The issue I have is when I kick on part 2 of the cron (03 04 28 * * root hammer content-view publish --organization ‘Main’ --name ‘EL8’ --lifecycle-environments dev,prod --description “New EL8 content as of $(date ‘+%F’) for Monthly Patching” --async) to publish the new content views. After it completes this, Foreman automatically triggers a proxy sync. It’s this sync I am talking about. Last month’s content didnt get synced properly to one of the locations, so I needed to run a full sync (under infrastructure) and it was OK again. I would like to run this full sync option when publishing the content view, if possible…

If someone could point me in the right direction so I can follow @sajha advice and put in a feature request to allow wildcards when synchronizing at repository lebel OR allowing full syncs at product level OR both, that would be great.

Could someone also please confirm if sync plans (which are at product level) are also only optimized syncs and no option to run as full? thanks

Ya…Currently, Sync plans only run optimized syncs on products…