Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
egarbuz merged 6 commits intomasterfromAdd_major_version_value_into_init_helper
Apr 10, 2024
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Break when pg_probackup version is incorrect
  • Loading branch information
@egarbuz
egarbuz committedApr 9, 2024
commit5db4ae393e4b4f69b5721b27e9c80fc3dcd5c044
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -204,9 +204,11 @@ def __init__(self):
os.environ["PGAPPNAME"] = "pg_probackup"
self.delete_logs = delete_logs

self.major_version = 0
if self.probackup_version.split('.')[0].isdigit:
Copy link
Contributor

Choose a reason for hiding this comment

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

Не .isdigit, а .isdigit(). .isdigit возвращает указатель на метод, который существует у любой строки, поэтому вернёт истинное значение для любой строки:

>>> if 'abc'.isdigit:...   print('aaa')... aaa

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Поправил, спасибо.

self.major_version = int(self.probackup_version.split('.')[0])
else:
print('Pg_probackup version is not correct!')
sys.exit(1)

Copy link
Contributor

Choose a reason for hiding this comment

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

Можно более безопасные преобразования сделат, на случай если в версии что-то не то будет.Либо не скастится в int либо не будет первого элемента

def test_env(self):
return self._test_env.copy()
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp