Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/vme/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ Release History
1.0.0b4
++++++
* Add '--force' to 'az vme uninstall' to force delete extension.

1.0.0b5
++++++
* Skip running animation if stdout is not a TTY.
11 changes: 8 additions & 3 deletions src/vme/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@ az extension add --name vme
### Included Features
#### Install version managed extensions with default configurations
```
az vme install --resource-group my-rg --name my-cluster --include all
az vme install --resource-group my-rg --cluster-name my-cluster --include all
```

#### List version managed extensions
```
az vme list --resource-group my-rg --cluster-name my-cluster --output table
```

#### Uninstall version managed extensions
```
az vme uninstall --resource-group my-rg --name my-cluster --include all
az vme uninstall --resource-group my-rg --cluster-name my-cluster --include all
```

#### Check version managed extensions' upgrade status
```
az vme upgrade --resource-group my-rg --name my-cluster --wait
az vme upgrade --resource-group my-rg --cluster-name my-cluster --wait
```
12 changes: 6 additions & 6 deletions src/vme/azext_vme/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def install_vme(
continue
except ResourceNotFoundError:
# The extension does not exist, proceed with installation
print(f"Installing extension {extension_type}...")
print(f"Installing extension {extension_type}...", flush=True)
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] There are multiple print(..., flush=True) calls; extracting a small helper function could reduce duplication and improve readability.

Suggested change
print(f"Installing extension {extension_type}...", flush=True)
_print_flush(f"Installing extension {extension_type}...")

Copilot uses AI. Check for mistakes.
command = [
str(shutil.which("az")),
"k8s-extension",
Expand All @@ -70,7 +70,7 @@ def install_vme(
"cluster"
]
result = utils.call_subprocess_raise_output(command)
print(f"Installed extension {extension_type} successfully.")
print(f"Installed extension {extension_type} successfully.", flush=True)
print(result)

if len(include_extension_types) > 1:
Expand All @@ -97,7 +97,7 @@ def uninstall_vme(

# Uninstall the bundle extensions one by one
for extension_type in include_extension_types:
print(f"Uninstalling extension {extension_type}...")
print(f"Uninstalling extension {extension_type}...", flush=True)
command = [str(shutil.which("az")),
"k8s-extension",
"delete",
Expand All @@ -113,7 +113,7 @@ def uninstall_vme(
if force:
command.append("--force")
utils.call_subprocess_raise_output(command)
print(f"Uninstalled extension {extension_type} successfully.")
print(f"Uninstalled extension {extension_type} successfully.", flush=True)
if len(include_extension_types) > 1:
print("All extensions uninstalled successfully.")

Expand Down Expand Up @@ -143,7 +143,7 @@ def upgrade_vme(
cmd, subscription_id, cluster, resource_group_name, cluster_name, kube_config, kube_context)
deployment_name = (consts.ARC_UPDATE_PREFIX + cluster_name).lower()
print(f"Checking arm template deployment '{deployment_name}' for '{cluster_resource_id}' "
f"which has agent version '{agent_version}'")
f"which has agent version '{agent_version}'", flush=True)

client = cf_deployments(cmd.cli_ctx, subscription_id)

Expand All @@ -167,7 +167,7 @@ def upgrade_vme(
f"[{timestamp}] The current deployment {deployment_name} is for {deployment_agent_version} "
f"instead of current agent version {agent_version}. {consts.UPGRADE_NOTSTARTED_MSG}"
)
print(msg)
print(msg, flush=True)
time.sleep(consts.UPGRADE_CHECK_INTERVAL)
continue
if utils.check_deployment_status(resources, deployment, timestamp):
Expand Down
6 changes: 6 additions & 0 deletions src/vme/azext_vme/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
logger = get_logger(__name__)


def supports_animation():
return sys.stdout.isatty()


class PollingAnimation:
def __init__(self):
self.tickers = ["/", "|", "\\", "-", "/", "|", "\\", "-"]
Expand Down Expand Up @@ -53,6 +57,8 @@ def call_subprocess_raise_output(cmd: list, logcmd: bool = False, logstatus: boo
# Log the command to be run, but do not log the password.
print(f"Running command: {' '.join(log_cmd)}")

if not supports_animation():
logstatus = False
if logstatus:
animation = PollingAnimation()
spinner_thread = threading.Thread(target=animation.tick)
Expand Down
2 changes: 1 addition & 1 deletion src/vme/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from setuptools import setup, find_packages

# HISTORY.rst entry.
VERSION = '1.0.0b4'
VERSION = '1.0.0b5'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
Loading