Skip to content
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

Added code to create a file that indicates Maintenance Mode #87

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mbhask000
Copy link
Contributor

No description provided.

@CLAassistant
Copy link

CLAassistant commented Aug 30, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@cholcombe973 cholcombe973 left a comment

Choose a reason for hiding this comment

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

It looks like service.rs is a new checked in file that is generated. I think it should probably be added to the .gitignore file. Overall this looks fine.

src/client.rs Outdated Show resolved Hide resolved
@sdandam sdandam self-requested a review August 30, 2019 15:56
@mbhask000
Copy link
Contributor Author

Changed SetMaintenance subcommand to set_maintenance

@mbhask000
Copy link
Contributor Author

Added additional code to remove the set maintenance status.

Copy link
Collaborator

@cholcombe973 cholcombe973 left a comment

Choose a reason for hiding this comment

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

Looks good to me

Copy link
Collaborator

@sdandam sdandam left a comment

Choose a reason for hiding this comment

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

Bynar should also bail out if it finds a lock file aka in maintenance mode.

src/client.rs Outdated
trace!("handle_set_maintenance called");
helpers::set_maintenance(s)?;
trace!("handle_set_maintenance finished");

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: extra line can be removed

src/client.rs Outdated
trace!("handle_unset_maintenance called");
helpers::unset_maintenance(s)?;
trace!("handle_unset_maintenance finished");

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: extra line can be removed

result.set_result(ResultType::OK);
}
Err(..) => {
result.set_result(ResultType::ERR);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think an error string should also be set here, so that the caller/client knows the reason why the operation failed

result.set_result(ResultType::OK);
}
Err(..) => {
result.set_result(ResultType::ERR);
Copy link
Collaborator

Choose a reason for hiding this comment

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

error string should be set here too.


pub fn set_maintenance(s: &mut Socket) -> BynarResult<()>{
let mut result = OpResult::new();
let file = match File::create("/var/log/setMaintenance.lock") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file location should be read from the config file

}
pub fn unset_maintenance(s: &mut Socket) -> BynarResult<()>{
let mut result = OpResult::new();
let file = match fs::remove_file("/var/log/setMaintenance.lock") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file location should be read from config file

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.

5 participants