-
Notifications
You must be signed in to change notification settings - Fork 13
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
Removing and recreating graphiteDB while upgrading tendrl #590
Conversation
bugzilla: 1658245 tendrl-bug-id: Tendrl#589 Signed-off-by: GowthamShanmugasundaram <gshanmug@redhat.com>
@shtripat @nthomas-redhat @dahorak please review |
utils.remove_file("/var/lib/graphite-web/graphite.db") | ||
utils.print_message("Initializing graphite DB") | ||
utils.command_exec( | ||
"django-admin migrate " | ||
"--settings=graphite.settings " | ||
"--run-syncdb" | ||
) |
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.
We should also properly set the ownership of the graphite.db
to apache
user and group.
It is true, that execution of tendrl-ansible will fix it also, but since the httpd
service is already started here in the next step, it will be safer to correct the ownership immediately when the database is initialized.
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.
I agree to this
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.
ok
"--settings=graphite.settings " | ||
"--run-syncdb" | ||
) | ||
|
||
utils.print_message("Starting httpd service") | ||
utils.start_service("httpd") |
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.
I think, that we should consider to start also the carbon-cache
service. As it was stopped by this script, it might be good to also start it here.
If it will stay stopped and somebody will accidentally run this script (not as part of the whole update workflow), it will leave the cluster in quite inconsistent state, without clearly visible reason (it will not be immediately clear, that the carbon-cache is stopped).
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.
It would be good to start carbon-cache here
utils.remove_file("/var/lib/graphite-web/graphite.db") | ||
utils.print_message("Initializing graphite DB") | ||
utils.command_exec( | ||
"django-admin migrate " | ||
"--settings=graphite.settings " | ||
"--run-syncdb" | ||
) |
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.
I agree to this
"--settings=graphite.settings " | ||
"--run-syncdb" | ||
) | ||
|
||
utils.print_message("Starting httpd service") | ||
utils.start_service("httpd") |
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.
It would be good to start carbon-cache here
import os | ||
|
||
|
||
def print_message(message): |
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.
Do we really need a utility function for printing message :)
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.
i saw messages are formatted with \n every where, that why i put print in utils, i think we don't need, i will revert it back
bugzilla: 1658245 tendrl-bug-id: Tendrl#589 Signed-off-by: GowthamShanmugasundaram <gshanmug@redhat.com>
Codecov Report
@@ Coverage Diff @@
## master #590 +/- ##
=========================================
Coverage ? 43.72%
=========================================
Files ? 42
Lines ? 2381
Branches ? 352
=========================================
Hits ? 1041
Misses ? 1287
Partials ? 53
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #590 +/- ##
=========================================
Coverage ? 43.33%
=========================================
Files ? 42
Lines ? 2402
Branches ? 356
=========================================
Hits ? 1041
Misses ? 1308
Partials ? 53
Continue to review full report at Codecov.
|
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.
Just one small proposal about splitting owner to separated arguments for user and gropu, otherwise it looks good to me.
There are other problems, related to the whole update script (and to this PR too) - for example, no handling for exceptions - but it is much wider issue and out of scope for PR.
print (ex) | ||
|
||
|
||
def change_owner(path, owner, recursive=False): |
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.
It this function should be "universally" used, it would be probably better, to separate owner to user and group arguments (instead of using one value for both.
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.
ah, i will modify and add exception handler for this
bugzilla: 1658245 tendrl-bug-id: Tendrl#589 Signed-off-by: GowthamShanmugasundaram <gshanmug@redhat.com>
I have created utility function and I put separate try-catch for wherever it required, now one function failure won't stop upgrade execution flow. |
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.
LGTM.
Hope its verified already.
bugzilla: 1658245
tendrl-bug-id: #589
Signed-off-by: GowthamShanmugasundaram gshanmug@redhat.com