Skip to content

add check to the doctor that the 'six' python package is installed on… #2612

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 20, 2017

Conversation

yyosifov
Copy link
Contributor

@yyosifov yyosifov commented Mar 15, 2017

When Python is installed on Mac via Brew it's missing the "six" python package, which is installed by default when using the default Python installer for Mac. The "six" python package is required from the CLI in order to work properly.

So, we added the check for "six" python package presence in the TNS Doctor so that it detects the missing piece and gives advice how to fix your environment.

let sixPackagesFoundCount = parseInt(queryForSixPackage);
if (sixPackagesFoundCount === 0) {
hasInvalidPackages = true;
this.$logger.error("Python 'six' package not found. Please install it by running 'pip install six' from the terminal.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you follow the same structure of messages as the others warnings:

this.$logger.warn("Python 'six' package not found.").
this.$logger.out("<information why do I need this package and what issues will occur in case I do not install it>. <information how to install this package>");

The concept is - warning message (in yellow) that something is missing and additional information how will this affect me and how to fix the issue (text will be in the default terminal color).

For example I do not know what's the idea of this package and I will not install it on my machine without evidence that I need it.

this.$logger.error("Python 'six' package not found. Please install it by running 'pip install six' from the terminal.");
}
} catch (error) {
this.$logger.error("Cannot retrieve python installed packages. Please, make sure you have both 'python' and 'pip' installed.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above - logger.warn + logger.out.
Additionally it's a good practice to add the real error to the trace logs:

this.$logger.trace(`Error while validating Python packages. Error is: ${error.message}`);

@Plamen5kov Plamen5kov self-requested a review March 17, 2017 07:00
Copy link
Contributor

@Plamen5kov Plamen5kov left a comment

Choose a reason for hiding this comment

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

Please provide a description for this PR:
What problem does it solve and what'll the behavior be after this PR.

@yyosifov yyosifov force-pushed the yosifov/add-six-check-to-doctor branch from 535ddb0 to 8c74f3a Compare March 20, 2017 11:48
@yyosifov
Copy link
Contributor Author

run ci

@yyosifov yyosifov merged commit 0b7540c into master Mar 20, 2017
@yyosifov yyosifov deleted the yosifov/add-six-check-to-doctor branch March 27, 2017 12:26
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