fix: missing accept server license terms arg in service install (#177366)

Fixes #177351
This commit is contained in:
Connor Peet 2023-03-16 11:23:35 -07:00 committed by GitHub
parent 461d828f9f
commit 025e3194e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View file

@ -647,7 +647,7 @@ pub enum TunnelSubcommand {
#[derive(Subcommand, Debug, Clone)]
pub enum TunnelServiceSubCommands {
/// Installs or re-installs the tunnel service on the machine.
Install,
Install(TunnelServiceInstallArgs),
/// Uninstalls and stops the tunnel service.
Uninstall,
@ -660,6 +660,13 @@ pub enum TunnelServiceSubCommands {
InternalRun,
}
#[derive(Args, Debug, Clone)]
pub struct TunnelServiceInstallArgs {
/// If set, the user accepts the server license terms and the server will be started without a user prompt.
#[clap(long)]
pub accept_server_license_terms: bool,
}
#[derive(Args, Debug, Clone)]
pub struct TunnelRenameArgs {
/// The name you'd like to rename your machine to.

View file

@ -113,14 +113,14 @@ pub async fn service(
) -> Result<i32, AnyError> {
let manager = create_service_manager(ctx.log.clone(), &ctx.paths);
match service_args {
TunnelServiceSubCommands::Install => {
TunnelServiceSubCommands::Install(args) => {
// ensure logged in, otherwise subsequent serving will fail
Auth::new(&ctx.paths, ctx.log.clone())
.get_credential()
.await?;
// likewise for license consent
legal::require_consent(&ctx.paths, false)?;
legal::require_consent(&ctx.paths, args.accept_server_license_terms)?;
let current_exe =
std::env::current_exe().map_err(|e| wrap(e, "could not get current exe"))?;
@ -377,11 +377,8 @@ async fn serve_with_csa(
let tunnel = if let Some(d) = gateway_args.tunnel.clone().into() {
dt.start_existing_tunnel(d).await
} else {
dt.start_new_launcher_tunnel(
gateway_args.name.as_deref(),
gateway_args.random_name,
)
.await
dt.start_new_launcher_tunnel(gateway_args.name.as_deref(), gateway_args.random_name)
.await
}?;
csa.connection_token = Some(get_connection_token(&tunnel));