-
Notifications
You must be signed in to change notification settings - Fork 35
Value pg_probackup major_version added to the class Init #119
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
Changes from 4 commits
3dc640f
2a0c37b
5db4ae3
3a90ecd
ea05a4a
5b8a836
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,6 +204,12 @@ def __init__(self): | |
os.environ["PGAPPNAME"] = "pg_probackup" | ||
self.delete_logs = delete_logs | ||
|
||
if self.probackup_version.split('.')[0].isdigit: | ||
self.major_version = int(self.probackup_version.split('.')[0]) | ||
else: | ||
print('Pg_probackup version \"{}\" is not correct!'.format(self.probackup_version)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Сообщение вида
никак не объясняет пользователю, в чём ошибка и что сделать, чтобы она не возникала. Нужно заменить на что-то вида:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Поправил текст выводимого сообщения об ошибке. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ошибочно утверждать, что версия некорректна, какой вид версии выбрать - это решение исключительно автора продукта. Вопрос здесь в том, что версия имеет не тот вид, который тестгрес ожидает для своей работы. Вариантом могло бы быть:
Восклицательные знаки, капслок и смайлики лучше не использовать в сообщениях для пользователя. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Обсудили, согласен с доводами. |
||
sys.exit(1) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Можно более безопасные преобразования сделат, на случай если в версии что-то не то будет.Либо не скастится в int либо не будет первого элемента |
||
def test_env(self): | ||
return self._test_env.copy() | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не .isdigit, а .isdigit(). .isdigit возвращает указатель на метод, который существует у любой строки, поэтому вернёт истинное значение для любой строки:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поправил, спасибо.