-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VNet in Connect: Send notification about bg item if not already enabl…
…ed (#44219) * Make serviceStatus public * Print to stdout when VNet is ready * Use executable name instead of saying "current executable" This error bubbles up to the UI in Connect. In that context, "the current executable" is ambiguous. * Send notification about bg item if not already enabled * Adjust notification copy Co-authored-by: Grzegorz Zdunek <gzdunek@users.noreply.github.com> --------- Co-authored-by: Grzegorz Zdunek <gzdunek@users.noreply.github.com>
- Loading branch information
Showing
12 changed files
with
621 additions
and
77 deletions.
There are no files selected for viewing
305 changes: 258 additions & 47 deletions
305
gen/proto/go/teleport/lib/teleterm/vnet/v1/vnet_service.pb.go
Large diffs are not rendered by default.
Oops, something went wrong.
48 changes: 45 additions & 3 deletions
48
gen/proto/go/teleport/lib/teleterm/vnet/v1/vnet_service_grpc.pb.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
gen/proto/ts/teleport/lib/teleterm/vnet/v1/vnet_service_pb.client.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
gen/proto/ts/teleport/lib/teleterm/vnet/v1/vnet_service_pb.grpc-server.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
124 changes: 123 additions & 1 deletion
124
gen/proto/ts/teleport/lib/teleterm/vnet/v1/vnet_service_pb.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Teleport | ||
// Copyright (C) 2024 Gravitational, Inc. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//go:build vnetdaemon | ||
// +build vnetdaemon | ||
|
||
package vnet | ||
|
||
import ( | ||
"context" | ||
"os" | ||
|
||
"github.com/gravitational/trace" | ||
|
||
api "github.com/gravitational/teleport/gen/proto/go/teleport/lib/teleterm/vnet/v1" | ||
"github.com/gravitational/teleport/lib/vnet" | ||
vnetdaemon "github.com/gravitational/teleport/lib/vnet/daemon" | ||
) | ||
|
||
func (s *Service) GetBackgroundItemStatus(ctx context.Context, req *api.GetBackgroundItemStatusRequest) (*api.GetBackgroundItemStatusResponse, error) { | ||
if os.Getenv(vnet.EnvFeatureFlag) != "yes" { | ||
return nil, trace.NotImplemented("tsh was built with VNet daemon support, but the feature flag is not enabled") | ||
} | ||
|
||
status, err := vnetdaemon.DaemonStatus() | ||
if err != nil { | ||
return nil, trace.Wrap(err) | ||
} | ||
|
||
return &api.GetBackgroundItemStatusResponse{ | ||
Status: backgroundItemStatusFromServiceStatus(status), | ||
}, nil | ||
} | ||
|
||
func backgroundItemStatusFromServiceStatus(status vnetdaemon.ServiceStatus) api.BackgroundItemStatus { | ||
switch status { | ||
case vnetdaemon.ServiceStatusNotRegistered: | ||
return api.BackgroundItemStatus_BACKGROUND_ITEM_STATUS_NOT_REGISTERED | ||
case vnetdaemon.ServiceStatusEnabled: | ||
return api.BackgroundItemStatus_BACKGROUND_ITEM_STATUS_ENABLED | ||
case vnetdaemon.ServiceStatusRequiresApproval: | ||
return api.BackgroundItemStatus_BACKGROUND_ITEM_STATUS_REQUIRES_APPROVAL | ||
case vnetdaemon.ServiceStatusNotFound: | ||
return api.BackgroundItemStatus_BACKGROUND_ITEM_STATUS_NOT_FOUND | ||
default: | ||
return api.BackgroundItemStatus_BACKGROUND_ITEM_STATUS_UNSPECIFIED | ||
} | ||
} |
Oops, something went wrong.