Skip to content

Commit 8a9498d

Browse files
Cleanup
Signed-off-by: Neaj Morshad <neaj@appscode.com>
1 parent f5bd4ba commit 8a9498d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pkg/cmds/mssql.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ func NewCmdDAGConfig(f cmdutil.Factory) *cobra.Command {
7575

7676
// runDAGConfig is now much simpler. It just orchestrates the steps.
7777
func runDAGConfig(ctx context.Context, f cmdutil.Factory, namespace, outputDir, mssqlServerName string) error {
78-
fmt.Printf("🔎 Generating DAG configuration for MSSQLServer '%s' in namespace '%s'...\n", mssqlServerName, namespace)
78+
fmt.Printf("Generating DAG configuration for MSSQLServer '%s' in namespace '%s'...\n", mssqlServerName, namespace)
7979

80-
// Use the new common constructor to get a validated options object
8180
opts, err := common.NewMSSQLOpts(f, mssqlServerName, namespace)
8281
if err != nil {
8382
return err // The error from NewMSSQLOpts will be very informative
@@ -105,9 +104,7 @@ func runDAGConfig(ctx context.Context, f cmdutil.Factory, namespace, outputDir,
105104
return nil
106105
}
107106

108-
// generateMSSQLDAGConfig now takes the opts object and is much more robust.
109107
func generateMSSQLDAGConfig(ctx context.Context, opts *common.MSSQLOpts) ([]byte, error) {
110-
// IMPROVEMENT: Get secret names directly from the CR status, not by guessing.
111108
secretNames := []string{
112109
opts.DB.DbmLoginSecretName(),
113110
opts.DB.MasterKeySecretName(),
@@ -117,10 +114,9 @@ func generateMSSQLDAGConfig(ctx context.Context, opts *common.MSSQLOpts) ([]byte
117114
var finalYAML []byte
118115
for _, secretName := range secretNames {
119116
fmt.Printf(" - Fetching secret '%s'...\n", secretName)
120-
// Use the client from the opts object to fetch the secret
117+
121118
secret, err := opts.Client.CoreV1().Secrets(opts.DB.Namespace).Get(ctx, secretName, metav1.GetOptions{})
122119
if err != nil {
123-
// No special error handling needed; if it's not found, something is wrong.
124120
return nil, fmt.Errorf("failed to get required secret '%s': %w", secretName, err)
125121
}
126122

0 commit comments

Comments
 (0)