Skip to content

catalog:images:resize CLI command fix #14154

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

Merged
merged 2 commits into from
Mar 21, 2018

Conversation

nfourteen
Copy link
Contributor

@nfourteen nfourteen commented Mar 17, 2018

Description

Updated catalog:images:resize CLI command to return correct exit code on failure. Currently, the conditional check to verify if there are any images to resize returns \Magento\Framework\Console\Cli::RETURN_SUCCESS (a const === 0) if there aren't any images. Per the comment above the return—"we must have an exit code higher than zero to indicate something was wrong"—this PR returns \Magento\Framework\Console\Cli::RETURN_FAILURE (a const === 1).

Fixed Issues (if relevant)

n/a

Manual testing scenarios

n/a

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@@ -71,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!count($productIds)) {
$output->writeln("<info>No product images to resize</info>");
// we must have an exit code higher than zero to indicate something was wrong
Copy link
Contributor

Choose a reason for hiding this comment

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

@okorshenko I'm wondering if the comment is correct in the first place. Should an error be triggered if there are no products? Running the command when there are no products / product images does no harm.

If exiting with an error is desired, we shoul also change the output from <info> to <error>.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @nfourteen , I agree with @mzeis , it's ok if the status code will be 'success' if no products in the store. Regarding the comment in the line above - status code was changed from 'failure' to 'success' in scope of bugfix and developer forget to remove this line. For now, it would be better remove comment line and leave status code as is.

@sidolov sidolov self-assigned this Mar 18, 2018
@@ -71,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!count($productIds)) {
$output->writeln("<info>No product images to resize</info>");
// we must have an exit code higher than zero to indicate something was wrong
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @nfourteen , I agree with @mzeis , it's ok if the status code will be 'success' if no products in the store. Regarding the comment in the line above - status code was changed from 'failure' to 'success' in scope of bugfix and developer forget to remove this line. For now, it would be better remove comment line and leave status code as is.

@nfourteen
Copy link
Contributor Author

Hello @sidolov and @mzeis, I updated the PR with the suggested changes. Thanks for your review.

@magento-engcom-team magento-engcom-team added this to the March 2018 milestone Mar 18, 2018
@magento-engcom-team
Copy link
Contributor

@nfourteen thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@magento-engcom-team
Copy link
Contributor

Hi @mzeis, thank you for the review.
ENGCOM-953 has been created to process this Pull Request

@magento-engcom-team magento-engcom-team merged commit 48367af into magento:2.2-develop Mar 21, 2018
@mzeis
Copy link
Contributor

mzeis commented Mar 21, 2018

Hi @nfourteen, thanks for your PR! It has been merged into 2.2-develop.

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

Successfully merging this pull request may close these issues.

4 participants