Skip to content

Commit

Permalink
refresh repositories without SCC credentials when calling from PaygUp…
Browse files Browse the repository at this point in the history
…dateAuthTask
  • Loading branch information
mcalmer authored and mackdk committed Oct 2, 2023
1 parent 5ed746f commit b6d73fc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ private List<MgrSyncProductDto> listProductsImpl() {
*
* @throws ContentSyncException in case of an error
*/
private void refreshRepositoriesAuthentication(String mirrorUrl) throws ContentSyncException {
private void refreshRepositoriesAuthentication(String mirrorUrl, boolean excludeSCC) throws ContentSyncException {
List<Credentials> credentials = filterCredentials();

ChannelFactory.cleanupOrphanVendorContentSource();
Expand All @@ -529,6 +529,9 @@ private void refreshRepositoriesAuthentication(String mirrorUrl) throws ContentS
List<SCCRepositoryJson> repos = new LinkedList<>();
LOG.debug("Getting repos for: {}", c);
if (c == null || c.isTypeOf(Credentials.TYPE_SCC)) {
if (excludeSCC) {
continue;
}
try {
SCCClient scc = getSCCClient(c);
repos = scc.listRepositories();
Expand Down Expand Up @@ -1395,10 +1398,21 @@ private void generateOEMOrderItems(List<SCCSubscriptionJson> subscriptions, Cred
*/
public void updateRepositories(String mirrorUrl) throws ContentSyncException {
LOG.info("ContentSyncManager.updateRepository called");
refreshRepositoriesAuthentication(mirrorUrl);
refreshRepositoriesAuthentication(mirrorUrl, false);
LOG.info("ContentSyncManager.updateRepository finished");
}

/**
* Update repositories and its available authentications for Payg only.
*
* @throws ContentSyncException in case of an error
*/
public void updateRepositoriesPayg() throws ContentSyncException {
LOG.info("ContentSyncManager.updateRepository payg called");
refreshRepositoriesAuthentication(null, true);
LOG.info("ContentSyncManager.updateRepository payg finished");
}

/**
* Update channel families in DB with data from the channel_families.json file.
* @param channelFamilies List of families.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void execute(JobExecutionContext jobExecutionContext) {

// Call the content sync manager to refresh all repositories content sources and the authorizations
try {
contentSyncManager.updateRepositories(null);
contentSyncManager.updateRepositoriesPayg();
}
catch (ContentSyncException ex) {
log.error("Unable to refresh repositories", ex);
Expand Down

0 comments on commit b6d73fc

Please sign in to comment.