Fix hooks.rs imports
// See the License for the specific language governing permissions and
// limitations under the License.
+use super::{package::Pkg,
+ TemplateRenderer};
+use crate::error::{Error,
+ Result};
+#[cfg(windows)]
+use habitat_core::os::process::windows_child::{Child,
+ ExitStatus};
+use habitat_core::{crypto,
+ fs,
+ outputln};
+use serde::{Serialize,
+ Serializer};
#[cfg(unix)]
use std::os::unix::process::{CommandExt,
ExitStatusExt};
@@ -23,27 +35,13 @@ use std::process::{Child,
use std::{ffi::OsStr,
fmt,
fs::File,
- io::{prelude::*,
+ io::{self,
+ prelude::*,
BufReader},
path::{Path,
PathBuf},
result};
-#[cfg(windows)]
-use crate::hcore::os::process::windows_child::{Child,
- ExitStatus};
-use crate::hcore::{self,
- crypto,
- fs,
- outputln};
-use serde::{Serialize,
- Serializer};
-
-use super::{package::Pkg,
- TemplateRenderer};
-use crate::error::{Error,
- Result};
-
#[cfg(not(windows))]
pub const HOOK_PERMISSIONS: u32 = 0o755;
static LOGKEY: &'static str = "HK";
@@ -166,15 +164,15 @@ pub trait Hook: fmt::Debug + Sized + Send {
}
#[cfg(not(windows))]
- fn set_permissions<T: AsRef<Path>>(path: T) -> hcore::error::Result<()> {
- use crate::hcore::util::posix_perm;
+ fn set_permissions<T: AsRef<Path>>(path: T) -> habitat_core::error::Result<()> {
+ use habitat_core::util::posix_perm;
posix_perm::set_permissions(path.as_ref(), HOOK_PERMISSIONS)
}
#[cfg(windows)]
- fn set_permissions<T: AsRef<Path>>(path: T) -> hcore::error::Result<()> {
- use crate::hcore::util::win_perm;
+ fn set_permissions<T: AsRef<Path>>(path: T) -> habitat_core::error::Result<()> {
+ use habitat_core::util::win_perm;
win_perm::harden_path(path.as_ref())
}
@@ -259,7 +257,7 @@ pub trait Hook: fmt::Debug + Sized + Send {
T: ToString,
S: AsRef<OsStr>,
{
- use crate::hcore::os::users;
+ use habitat_core::os::users;
let mut cmd = Command::new(path.as_ref());
cmd.stdin(Stdio::null())
@@ -534,16 +532,15 @@ impl<'a> HookOutput<'a> {
#[cfg(test)]
mod tests {
- use crate::hcore::{package::{PackageIdent,
- PackageInstall},
- service::ServiceGroup};
- use tempfile::TempDir;
-
use super::*;
use crate::templating::{config::Cfg,
context::RenderContext,
package::Pkg,
test_helpers::*};
+ use habitat_core::{package::{PackageIdent,
+ PackageInstall},
+ service::ServiceGroup};
+ use tempfile::TempDir;
// Turns out it's useful for Hooks to implement AsRef<Path>, at
// least for these tests. Ideally, this would be useful to use
