Skip to content

fix: allow empty import without error, fix search index export on accounts where it is disabled#125

Merged
rs-amp merged 3 commits into
amplience:masterfrom
rs-amp:fix/empty-import
May 5, 2022
Merged

fix: allow empty import without error, fix search index export on accounts where it is disabled#125
rs-amp merged 3 commits into
amplience:masterfrom
rs-amp:fix/empty-import

Conversation

@rs-amp
Copy link
Copy Markdown
Contributor

@rs-amp rs-amp commented Jan 26, 2022

This PR fixes an issue where empty import on certain commands would cause the command to error out, which would interrupt the clone command despite the import technically succeeding (as it didn't have to do anything).

This also fixes an issue where search index list would throw an exception if it is disabled on the target account. In this case, the export is now simply skipped.

Comment thread src/commands/search-index/export.ts Outdated
try {
allStoredIndexes = await paginator(searchIndexList(hub));
} catch (e) {
log.warn('Could not get Search Indexes for the given hub - they may be disabled.', e);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should check the HAL link on the hub to see if search-indexes are available for that given Hub.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The management sdk seems to report that _links is a Map<..>, but it's just a regular object. I've done this, but I had to cast _links to any to get it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, can just use hasOwnProperty with no need to cast.

@mdinning-amp mdinning-amp self-requested a review May 5, 2022 11:05
@rs-amp rs-amp force-pushed the fix/empty-import branch from 4176f5e to 2972e01 Compare May 5, 2022 11:27
@rs-amp rs-amp merged commit cce328b into amplience:master May 5, 2022
Pureball pushed a commit to cosnova/dc-cli that referenced this pull request Aug 22, 2023
…ounts where it is disabled (amplience#125)

This PR fixes an issue where empty import on certain commands would cause the command to error out, which would interrupt the clone command despite the import technically succeeding (as it didn't have to do anything).

This also fixes an issue where search index list would throw an exception if it is disabled on the target account. In this case, the export is now simply skipped.
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

Successfully merging this pull request may close these issues.

3 participants