Skip to content

Commit b393aa5

Browse files
committed
fix(commands): address bot review feedback
- Use %w instead of %s for error wrapping to preserve error chains - Fix typo: 'clinet' -> 'client' in comment - Document Offline: true limitation in buildApplyRenderOptions (Helm lookup() not available; use 'talm template' for online rendering) Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
1 parent 1c5b611 commit b393aa5

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

pkg/commands/apply.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ var applyCmd = &cobra.Command{
7878
}
7979
applyCmdFlags.nodesFromArgs = len(GlobalArgs.Nodes) > 0
8080
applyCmdFlags.endpointsFromArgs = len(GlobalArgs.Endpoints) > 0
81-
// Set dummy endpoint to avoid errors on building clinet
81+
// Set dummy endpoint to avoid errors on building client
8282
if len(GlobalArgs.Endpoints) == 0 {
8383
GlobalArgs.Endpoints = append(GlobalArgs.Endpoints, "127.0.0.1")
8484
}
@@ -118,20 +118,20 @@ func apply(args []string) error {
118118
opts := buildApplyRenderOptions(modelineTemplates, withSecretsPath)
119119
result, err = engine.Render(ctx, nil, opts)
120120
if err != nil {
121-
return fmt.Errorf("template rendering error: %s", err)
121+
return fmt.Errorf("template rendering error: %w", err)
122122
}
123123
} else {
124124
// Direct patch path: apply config file as patch against empty bundle
125125
opts := buildApplyPatchOptions(withSecretsPath)
126126
patches := []string{"@" + configFile}
127127
configBundle, machineType, err := engine.FullConfigProcess(ctx, opts, patches)
128128
if err != nil {
129-
return fmt.Errorf("full config processing error: %s", err)
129+
return fmt.Errorf("full config processing error: %w", err)
130130
}
131131

132132
result, err = engine.SerializeConfiguration(configBundle, machineType)
133133
if err != nil {
134-
return fmt.Errorf("error serializing configuration: %s", err)
134+
return fmt.Errorf("error serializing configuration: %w", err)
135135
}
136136
}
137137

@@ -185,6 +185,9 @@ func apply(args []string) error {
185185
}
186186

187187
// buildApplyRenderOptions constructs engine.Options for the template rendering path.
188+
// Offline is set to true because at this point we don't have a Talos client for
189+
// Helm lookup functions. Templates that use lookup() should be rendered via
190+
// 'talm template' which supports online mode.
188191
func buildApplyRenderOptions(modelineTemplates []string, withSecretsPath string) engine.Options {
189192
resolvedTemplates := resolveTemplatePaths(modelineTemplates, Config.RootDir)
190193
return engine.Options{

0 commit comments

Comments
 (0)