Skip to content

Commit fb0842f

Browse files
committed
fix merge
1 parent ff704ed commit fb0842f

File tree

2 files changed

+0
-104
lines changed

2 files changed

+0
-104
lines changed

cli/templatecreate.go

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -47,46 +47,7 @@ func (r *RootCmd) templateCreate() *clibase.Cmd {
4747
r.InitClient(client),
4848
),
4949
Handler: func(inv *clibase.Invocation) error {
50-
<<<<<<< HEAD
51-
<<<<<<< HEAD
52-
isTemplateSchedulingOptionsSet := failureTTL != 0 || dormancyThreshold != 0 || dormancyAutoDeletion != 0 || maxTTL != 0
53-
54-
if isTemplateSchedulingOptionsSet || requireActiveVersion {
55-
if failureTTL != 0 || dormancyThreshold != 0 || dormancyAutoDeletion != 0 {
56-
// This call can be removed when workspace_actions is no longer experimental
57-
experiments, exErr := client.Experiments(inv.Context())
58-
if exErr != nil {
59-
return xerrors.Errorf("get experiments: %w", exErr)
60-
}
61-
62-
if !experiments.Enabled(codersdk.ExperimentWorkspaceActions) {
63-
return xerrors.Errorf("--failure-ttl, --dormancy-threshold, and --dormancy-auto-deletion are experimental features. Use the workspace_actions CODER_EXPERIMENTS flag to set these configuration values.")
64-
}
65-
}
66-
67-
entitlements, err := client.Entitlements(inv.Context())
68-
if cerr, ok := codersdk.AsError(err); ok && cerr.StatusCode() == http.StatusNotFound {
69-
return xerrors.Errorf("your deployment appears to be an AGPL deployment, so you cannot set enterprise-only flags")
70-
} else if err != nil {
71-
return xerrors.Errorf("get entitlements: %w", err)
72-
}
73-
74-
if isTemplateSchedulingOptionsSet {
75-
if !entitlements.Features[codersdk.FeatureAdvancedTemplateScheduling].Enabled {
76-
return xerrors.Errorf("your license is not entitled to use advanced template scheduling, so you cannot set --failure-ttl, --inactivity-ttl, or --max-ttl")
77-
}
78-
}
79-
80-
if requireActiveVersion {
81-
if !entitlements.Features[codersdk.FeatureAccessControl].Enabled {
82-
return xerrors.Errorf("your license is not entitled to use enterprise access control, so you cannot set --require-active-version")
83-
}
84-
}
85-
=======
86-
err := handleEntitlements(inv.Context(), handleEntitlementsArgs{
87-
=======
8850
err := createEntitlementsCheck(inv.Context(), handleEntitlementsArgs{
89-
>>>>>>> 3c377e5d3 (combine edit flags)
9051
client: client,
9152
requireActiveVersion: requireActiveVersion,
9253
defaultTTL: defaultTTL,
@@ -97,7 +58,6 @@ func (r *RootCmd) templateCreate() *clibase.Cmd {
9758
})
9859
if err != nil {
9960
return err
100-
>>>>>>> 7b0afe8e9 (fix: make template push a superset of template create)
10161
}
10262

10363
organization, err := CurrentOrganization(inv, client)
@@ -420,15 +380,6 @@ func createEntitlementsCheck(ctx context.Context, args handleEntitlementsArgs) e
420380
if !entitlements.Features[codersdk.FeatureAccessControl].Enabled {
421381
return xerrors.Errorf("your license is not entitled to use enterprise access control, so you cannot set --require-active-version")
422382
}
423-
424-
experiments, exErr := args.client.Experiments(ctx)
425-
if exErr != nil {
426-
return xerrors.Errorf("get experiments: %w", exErr)
427-
}
428-
429-
if !experiments.Enabled(codersdk.ExperimentTemplateUpdatePolicies) {
430-
return xerrors.Errorf("--require-active-version is an experimental feature, contact an administrator to enable the 'template_update_policies' experiment on your Coder server")
431-
}
432383
}
433384
}
434385

cli/templateedit.go

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -47,52 +47,6 @@ func (r *RootCmd) templateEdit() *clibase.Cmd {
4747
),
4848
Short: "Edit the metadata of a template by name.",
4949
Handler: func(inv *clibase.Invocation) error {
50-
<<<<<<< HEAD
51-
// This clause can be removed when workspace_actions is no longer experimental
52-
if failureTTL != 0 || dormancyThreshold != 0 || dormancyAutoDeletion != 0 {
53-
experiments, exErr := client.Experiments(inv.Context())
54-
if exErr != nil {
55-
return xerrors.Errorf("get experiments: %w", exErr)
56-
}
57-
58-
if !experiments.Enabled(codersdk.ExperimentWorkspaceActions) {
59-
return xerrors.Errorf("--failure-ttl, --dormancy-threshold, and --dormancy-auto-deletion are experimental features. Use the workspace_actions CODER_EXPERIMENTS flag to set these configuration values.")
60-
}
61-
}
62-
63-
unsetAutostopRequirementDaysOfWeek := len(autostopRequirementDaysOfWeek) == 1 && autostopRequirementDaysOfWeek[0] == "none"
64-
requiresScheduling := (len(autostopRequirementDaysOfWeek) > 0 && !unsetAutostopRequirementDaysOfWeek) ||
65-
autostopRequirementWeeks > 0 ||
66-
!allowUserAutostart ||
67-
!allowUserAutostop ||
68-
maxTTL != 0 ||
69-
failureTTL != 0 ||
70-
dormancyThreshold != 0 ||
71-
dormancyAutoDeletion != 0 ||
72-
len(autostartRequirementDaysOfWeek) > 0
73-
74-
requiresEntitlement := requiresScheduling || requireActiveVersion
75-
if requiresEntitlement {
76-
entitlements, err := client.Entitlements(inv.Context())
77-
if cerr, ok := codersdk.AsError(err); ok && cerr.StatusCode() == http.StatusNotFound {
78-
return xerrors.Errorf("your deployment appears to be an AGPL deployment, so you cannot set enterprise-only flags")
79-
} else if err != nil {
80-
return xerrors.Errorf("get entitlements: %w", err)
81-
}
82-
83-
if requiresScheduling && !entitlements.Features[codersdk.FeatureAdvancedTemplateScheduling].Enabled {
84-
return xerrors.Errorf("your license is not entitled to use advanced template scheduling, so you cannot set --max-ttl, --failure-ttl, --inactivityTTL, --allow-user-autostart=false or --allow-user-autostop=false")
85-
}
86-
87-
if requireActiveVersion {
88-
if !entitlements.Features[codersdk.FeatureAccessControl].Enabled {
89-
return xerrors.Errorf("your license is not entitled to use enterprise access control, so you cannot set --require-active-version")
90-
}
91-
}
92-
}
93-
94-
=======
95-
>>>>>>> 3c377e5d3 (combine edit flags)
9650
organization, err := CurrentOrganization(inv, client)
9751
if err != nil {
9852
return xerrors.Errorf("get current organization: %w", err)
@@ -341,15 +295,6 @@ func editTemplateEntitlementsCheck(ctx context.Context, args editTemplateEntitle
341295
if !entitlements.Features[codersdk.FeatureAccessControl].Enabled {
342296
return false, xerrors.Errorf("your license is not entitled to use enterprise access control, so you cannot set --require-active-version")
343297
}
344-
345-
experiments, exErr := args.client.Experiments(ctx)
346-
if exErr != nil {
347-
return false, xerrors.Errorf("get experiments: %w", exErr)
348-
}
349-
350-
if !experiments.Enabled(codersdk.ExperimentTemplateUpdatePolicies) {
351-
return false, xerrors.Errorf("--require-active-version is an experimental feature, contact an administrator to enable the 'template_update_policies' experiment on your Coder server")
352-
}
353298
}
354299
}
355300

0 commit comments

Comments
 (0)