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

fixes using a svc_user on windows #7049

Merged
merged 1 commit into from Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .buildkite/release_pipeline.yaml
Expand Up @@ -271,6 +271,7 @@ steps:
environment:
- HAB_BLDR_CHANNEL
- HAB_AUTH_TOKEN
- HAB_CRYPTO_KEY
- HAB_LICENSE
- BUILDKITE_JOB_ID
- BUILDKITE_AGENT_ACCESS_TOKEN
Expand Down
14 changes: 11 additions & 3 deletions components/common/src/command/package/install.rs
Expand Up @@ -45,6 +45,7 @@ use crate::{api_client::{self,
pkg_install_path,
svc_hooks_path,
AtomicWriter},
os::users,
package::{list::temp_package_directory,
Identifiable,
PackageArchive,
Expand Down Expand Up @@ -405,9 +406,16 @@ fn run_install_hook<T>(ui: &mut T, package: &PackageInstall) -> Result<()>
ui.status(Status::Executing,
format!("install hook for '{}'", &package.ident(),))?;
templating::compile_for_package_install(package)?;
if !hook.run(&package.ident().name,
&Pkg::from_install(package)?,
None::<&str>)
let mut pkg = Pkg::from_install(package)?;
// Only windows uses svc_password
if cfg!(target_os = "windows") {
// Install hooks do not have access to svc_passwords so
// we execute them under the current user account.
if let Some(user) = users::get_current_username() {
pkg.svc_user = user;
}
}
if !hook.run(&package.ident().name, &pkg, None::<&str>)
.unwrap_or(false)
{
return Err(Error::InstallHookFailed(package.ident().clone()));
Expand Down
10 changes: 9 additions & 1 deletion components/sup/src/manager/service/spec.rs
Expand Up @@ -107,8 +107,16 @@ pub struct ServiceSpec {
#[serde(with = "serde_string")]
pub desired_state: DesiredState,
pub shutdown_timeout: Option<ShutdownTimeout>,
pub health_check_interval: HealthCheckInterval,
pub svc_encrypted_password: Option<String>,
// it is important that the health check interval
// is the last field to be serialized because it
// is serialized as a table. Individual values
// serialized after the health check interval will
// break the parser.
// Note that there is an issue to ultimately fix this:
// https://github.com/habitat-sh/habitat/issues/6469
// and eliminate the need to keep this field last.
pub health_check_interval: HealthCheckInterval,
mwrock marked this conversation as resolved.
Show resolved Hide resolved
}

impl ServiceSpec {
Expand Down