-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2596: fix(si): determine Docker socket location on macOS r=fnichol a=fnichol This change refactors how the various Docker clients are configured in `lib/si-cli` by moving container (currently only Docker) related functions into a `DockerClient` type as methods. A first-pass refactoring extracts the hardcoded paths of `//var/run/docker.sock` into one location, early in the launcher's `main()` function. As Docker Desktop on macOS doesn't necessarily mount the Docker socket at `/var/run/docker.sock`, the socket is first looked for in `$HOME/.docker/run/docker.sock` before falling back on the system location. If neither is found, then an error message is displayed, indicating a suitable Docker socket was not found. Co-authored-by: Fletcher Nichol <[email protected]>
- Loading branch information
Showing
11 changed files
with
381 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
use crate::containers::DockerClient; | ||
use crate::key_management::get_user_email; | ||
use crate::state::AppState; | ||
use crate::CliResult; | ||
|
||
impl AppState { | ||
pub async fn restart(&self) -> CliResult<()> { | ||
pub async fn restart(&self, docker: &DockerClient) -> CliResult<()> { | ||
self.track( | ||
get_user_email().await?, | ||
serde_json::json!({"command-name": "restart-system"}), | ||
); | ||
invoke(self).await?; | ||
invoke(self, docker).await?; | ||
Ok(()) | ||
} | ||
} | ||
|
||
async fn invoke(app: &AppState) -> CliResult<()> { | ||
app.stop().await?; | ||
app.start().await?; | ||
async fn invoke(app: &AppState, docker: &DockerClient) -> CliResult<()> { | ||
app.stop(docker).await?; | ||
app.start(docker).await?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.