fix: warn when automation-profile add --update given but no existing profile #10666
@@ -20,6 +20,13 @@ Feature: Automation Profile CLI commands
|
||||
Then the automation-profile add should succeed
|
||||
And the automation-profile output should contain "Updated"
|
||||
|
||||
Scenario: Add profile with --update when profile does not exist warns and creates
|
||||
Given a valid automation profile config YAML file
|
||||
When I run automation-profile add with --config and --update
|
||||
Then the automation-profile add should succeed
|
||||
And the automation-profile output should contain "Warning"
|
||||
And the automation-profile output should contain "Profile Added"
|
||||
|
||||
Scenario: Add profile conflict without --update
|
||||
Given a valid automation profile config YAML file
|
||||
And the custom profile "acme/strict" already exists
|
||||
|
||||
@@ -236,6 +236,12 @@ def add_profile(
|
||||
)
|
||||
raise typer.Abort()
|
||||
|
||||
if update and not existing:
|
||||
console.print(
|
||||
f"[yellow]Warning:[/yellow] Profile '{name}' does not exist. "
|
||||
f"Creating new profile (--update flag has no effect)."
|
||||
)
|
||||
|
||||
if update and existing:
|
||||
profile = service.update_profile(name, config_data)
|
||||
title = "Profile Updated"
|
||||
|
||||
Reference in New Issue
Block a user