Skip to content

Commit 53c8e28

Browse files
committed
fixup: service_name
1 parent 68a27d5 commit 53c8e28

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/action/common/configure_init_service.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl Action for ConfigureInitService {
242242
let service_dest = service_dest
243243
.as_ref()
244244
.expect("service_dest should be set for Launchd");
245-
let service = service_name
245+
let service_name = service_name
246246
.as_ref()
247247
.expect("service_name should be set for Launchd");
248248
let domain = DARWIN_LAUNCHD_DOMAIN;
@@ -259,27 +259,27 @@ impl Action for ConfigureInitService {
259259
})?;
260260
}
261261

262-
crate::action::macos::retry_bootstrap(domain, service, service_dest)
262+
crate::action::macos::retry_bootstrap(domain, service_name, service_dest)
263263
.await
264264
.map_err(Self::error)?;
265265

266-
let is_disabled = crate::action::macos::service_is_disabled(domain, service)
266+
let is_disabled = crate::action::macos::service_is_disabled(domain, service_name)
267267
.await
268268
.map_err(Self::error)?;
269269
if is_disabled {
270270
execute_command(
271271
Command::new("launchctl")
272272
.process_group(0)
273273
.arg("enable")
274-
.arg(format!("{domain}/{service}"))
274+
.arg(format!("{domain}/{service_name}"))
275275
.stdin(std::process::Stdio::null()),
276276
)
277277
.await
278278
.map_err(Self::error)?;
279279
}
280280

281281
if *start_daemon {
282-
crate::action::macos::retry_kickstart(domain, service)
282+
crate::action::macos::retry_kickstart(domain, service_name)
283283
.await
284284
.map_err(Self::error)?;
285285
}

src/action/macos/bootstrap_launchctl_service.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ Bootstrap and kickstart an APFS volume
1616
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
1717
#[serde(tag = "action_name", rename = "bootstrap_launchctl_service")]
1818
pub struct BootstrapLaunchctlService {
19-
service: String,
19+
service_name: String,
2020
path: PathBuf,
2121
is_present: bool,
2222
is_disabled: bool,
2323
}
2424

2525
impl BootstrapLaunchctlService {
2626
#[tracing::instrument(level = "debug", skip_all)]
27-
pub async fn plan(service: &str, path: &str) -> Result<StatefulAction<Self>, ActionError> {
28-
let service = service.to_owned();
27+
pub async fn plan(service_name: &str, path: &str) -> Result<StatefulAction<Self>, ActionError> {
28+
let service_name = service_name.to_owned();
2929
let path = PathBuf::from(path);
3030

3131
let is_present = {
3232
let mut command = Command::new("launchctl");
3333
command.process_group(0);
3434
command.arg("print");
35-
command.arg(format!("{DARWIN_LAUNCHD_DOMAIN}/{service}"));
35+
command.arg(format!("{DARWIN_LAUNCHD_DOMAIN}/{service_name}"));
3636
command.stdin(std::process::Stdio::null());
3737
command.stdout(std::process::Stdio::piped());
3838
command.stderr(std::process::Stdio::piped());
@@ -44,12 +44,12 @@ impl BootstrapLaunchctlService {
4444
command_output.status.success()
4545
};
4646

47-
let is_disabled = service_is_disabled(DARWIN_LAUNCHD_DOMAIN, &service)
47+
let is_disabled = service_is_disabled(DARWIN_LAUNCHD_DOMAIN, &service_name)
4848
.await
4949
.map_err(Self::error)?;
5050

5151
Ok(StatefulAction::uncompleted(Self {
52-
service,
52+
service_name,
5353
path,
5454
is_present,
5555
is_disabled,
@@ -66,7 +66,7 @@ impl Action for BootstrapLaunchctlService {
6666
fn tracing_synopsis(&self) -> String {
6767
format!(
6868
"Bootstrap the `{}` service via `launchctl bootstrap {} {}`",
69-
self.service,
69+
self.service_name,
7070
DARWIN_LAUNCHD_DOMAIN,
7171
self.path.display()
7272
)
@@ -89,7 +89,7 @@ impl Action for BootstrapLaunchctlService {
8989
#[tracing::instrument(level = "debug", skip_all)]
9090
async fn execute(&mut self) -> Result<(), ActionError> {
9191
let Self {
92-
service,
92+
service_name,
9393
path,
9494
is_present,
9595
is_disabled,
@@ -100,20 +100,20 @@ impl Action for BootstrapLaunchctlService {
100100
Command::new("launchctl")
101101
.process_group(0)
102102
.arg("enable")
103-
.arg(format!("{DARWIN_LAUNCHD_DOMAIN}/{service}"))
103+
.arg(format!("{DARWIN_LAUNCHD_DOMAIN}/{service_name}"))
104104
.stdin(std::process::Stdio::null()),
105105
)
106106
.await
107107
.map_err(Self::error)?;
108108
}
109109

110110
if *is_present {
111-
crate::action::macos::retry_bootout(DARWIN_LAUNCHD_DOMAIN, service)
111+
crate::action::macos::retry_bootout(DARWIN_LAUNCHD_DOMAIN, service_name)
112112
.await
113113
.map_err(Self::error)?;
114114
}
115115

116-
crate::action::macos::retry_bootstrap(DARWIN_LAUNCHD_DOMAIN, service, path)
116+
crate::action::macos::retry_bootstrap(DARWIN_LAUNCHD_DOMAIN, service_name, path)
117117
.await
118118
.map_err(Self::error)?;
119119

@@ -133,7 +133,7 @@ impl Action for BootstrapLaunchctlService {
133133

134134
#[tracing::instrument(level = "debug", skip_all)]
135135
async fn revert(&mut self) -> Result<(), ActionError> {
136-
crate::action::macos::retry_bootout(DARWIN_LAUNCHD_DOMAIN, &self.service)
136+
crate::action::macos::retry_bootout(DARWIN_LAUNCHD_DOMAIN, &self.service_name)
137137
.await
138138
.map_err(Self::error)?;
139139

0 commit comments

Comments
 (0)