@@ -96,17 +96,6 @@ func Entitlements(
96
96
return codersdk.Entitlements {}, xerrors .Errorf ("query active user count: %w" , err )
97
97
}
98
98
99
- // nolint:gocritic // Getting external workspaces is a system function.
100
- externalWorkspaces , err := db .GetWorkspaces (dbauthz .AsSystemRestricted (ctx ), database.GetWorkspacesParams {
101
- HasExternalAgent : sql.NullBool {
102
- Bool : true ,
103
- Valid : true ,
104
- },
105
- })
106
- if err != nil {
107
- return codersdk.Entitlements {}, xerrors .Errorf ("query external workspaces: %w" , err )
108
- }
109
-
110
99
// nolint:gocritic // Getting external templates is a system function.
111
100
externalTemplates , err := db .GetTemplatesWithFilter (dbauthz .AsSystemRestricted (ctx ), database.GetTemplatesWithFilterParams {
112
101
HasExternalAgent : sql.NullBool {
@@ -119,11 +108,10 @@ func Entitlements(
119
108
}
120
109
121
110
entitlements , err := LicensesEntitlements (ctx , now , licenses , enablements , keys , FeatureArguments {
122
- ActiveUserCount : activeUserCount ,
123
- ReplicaCount : replicaCount ,
124
- ExternalAuthCount : externalAuthCount ,
125
- ExternalWorkspaceCount : int64 (len (externalWorkspaces )),
126
- ExternalTemplateCount : int64 (len (externalTemplates )),
111
+ ActiveUserCount : activeUserCount ,
112
+ ReplicaCount : replicaCount ,
113
+ ExternalAuthCount : externalAuthCount ,
114
+ ExternalTemplateCount : int64 (len (externalTemplates )),
127
115
ManagedAgentCountFn : func (ctx context.Context , startTime time.Time , endTime time.Time ) (int64 , error ) {
128
116
// This is not super accurate, as the start and end times will be
129
117
// truncated to the date in UTC timezone. This is an optimization
@@ -149,11 +137,10 @@ func Entitlements(
149
137
}
150
138
151
139
type FeatureArguments struct {
152
- ActiveUserCount int64
153
- ReplicaCount int
154
- ExternalAuthCount int
155
- ExternalWorkspaceCount int64
156
- ExternalTemplateCount int64
140
+ ActiveUserCount int64
141
+ ReplicaCount int
142
+ ExternalAuthCount int
143
+ ExternalTemplateCount int64
157
144
// Unfortunately, managed agent count is not a simple count of the current
158
145
// state of the world, but a count between two points in time determined by
159
146
// the licenses.
@@ -477,18 +464,6 @@ func LicensesEntitlements(
477
464
}
478
465
}
479
466
480
- if featureArguments .ExternalWorkspaceCount > 0 {
481
- feature := entitlements .Features [codersdk .FeatureWorkspaceExternalAgent ]
482
- switch feature .Entitlement {
483
- case codersdk .EntitlementNotEntitled :
484
- entitlements .Errors = append (entitlements .Errors ,
485
- "You have external workspaces but your license is not entitled to this feature." )
486
- case codersdk .EntitlementGracePeriod :
487
- entitlements .Warnings = append (entitlements .Warnings ,
488
- "You have external workspaces but your license is expired." )
489
- }
490
- }
491
-
492
467
if featureArguments .ExternalTemplateCount > 0 {
493
468
feature := entitlements .Features [codersdk .FeatureWorkspaceExternalAgent ]
494
469
switch feature .Entitlement {
0 commit comments