-
Notifications
You must be signed in to change notification settings - Fork 314
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
Hab-sup-run arguments modified. #8464
Conversation
👷 Deploy Preview for chef-habitat processing.
|
I did a little digging and it looks like the reason As for handling the issue with the move compile errors, see my comments in the code for how to deal with that. |
@@ -22,7 +23,8 @@ const LAUNCH_PKG_IDENT: &str = "core/hab-launcher"; | |||
|
|||
pub async fn start(ui: &mut UI, sup_run: SupRun, args: &[OsString]) -> Result<()> { | |||
init()?; | |||
let channel = sup_run.shared_load.channel; | |||
//let channel = sup_run.shared_load.channel; | |||
let channel = SharedLoad::from(sup_run).channel; |
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.
send a reference: SharedLoad::from(&sup_run).channel
components/sup/src/main.rs
Outdated
|
||
let shared_load = sup_run.shared_load; | ||
//let shared_load = sup_run.shared_load; | ||
let shared_load = hab::cli::hab::svc::SharedLoad::from(sup_run); |
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.
send a reference: SharedLoad::from(&sup_run)
components/hab/src/cli/hab/sup.rs
Outdated
} | ||
|
||
impl From<SupRun> for SharedLoad { | ||
fn from(sup_run: SupRun) -> Self { | ||
Self { |
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.
The definition can be:
impl From<&SupRun> for SharedLoad {
fn from(sup_run: &SupRun) -> Self {
components/hab/src/cli/hab/sup.rs
Outdated
password: sup_run.password, | ||
environment: sup_run.environment, | ||
application: sup_run.application, | ||
config_from: sup_run.config_from, |
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.
Use clone()
on these fields: config_from: sup_run.config_from.clone()
pub config_from: Option<PathBuf>, | ||
} | ||
|
||
impl From<&SupRun> for SharedLoad { |
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 if you moved this to svc.rs then you could avoid having to make some of those members public.
components/hab/src/cli/hab/sup.rs
Outdated
bind: sup_run.bind.clone(), | ||
update_condition: sup_run.update_condition.unwrap_or(UpdateCondition::Latest), | ||
binding_mode: sup_run.binding_mode.unwrap_or(BindingMode::Strict), | ||
health_check_interval: sup_run.health_check_interval.unwrap_or(30), |
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 be calling health_check_interval_default
instead of the 30
.
@@ -22,7 +23,7 @@ const LAUNCH_PKG_IDENT: &str = "core/hab-launcher"; | |||
|
|||
pub async fn start(ui: &mut UI, sup_run: SupRun, args: &[OsString]) -> Result<()> { | |||
init()?; | |||
let channel = sup_run.shared_load.channel; | |||
let channel = SharedLoad::from(&sup_run).channel; |
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 this could just be sup_run.channel
now and no need to transform to a SharedLoad
.
components/hab/src/cli/hab/svc.rs
Outdated
@@ -30,6 +30,8 @@ use walkdir::WalkDir; | |||
|
|||
const DEFAULT_SVC_CONFIG_FILE: &str = "/hab/sup/default/config/svc.toml"; | |||
pub const DEFAULT_SVC_CONFIG_DIR: &str = "/hab/sup/default/config/svc"; | |||
pub const HEALTH_CHECK_INTERVAL_DEFAULT: u64 = 30; | |||
const HEALTH_CHECK_INTERVAL_STR_DEFAULT: &str = "30"; |
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 don't think this is necessary. See comment below.
@@ -201,7 +203,7 @@ pub struct SharedLoad { | |||
// serialization format. We want to allow the user to simply specify a `u64` to be consistent | |||
// with the CLI, but we cannot change the serialization because the spec file depends on the map | |||
// based format. | |||
#[structopt(long = "health-check-interval", short = "i", default_value = "30")] | |||
#[structopt(long = "health-check-interval", short = "i", default_value = HEALTH_CHECK_INTERVAL_STR_DEFAULT)] | |||
#[serde(default = "health_check_interval_default")] |
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.
could be : default_value = &HEALTH_CHECK_INTERVAL_DEFAULT.to_string()
… hab sup run. Signed-off-by: dikshagupta1 <diksha.gupta@progress.com>
d5c6981
to
cd05d44
Compare
Raise usage errors if inappropriate hab svc load options are given in hab sup run.
Signed-off-by: dikshagupta1 diksha.gupta@progress.com