Skip to content

Commit f6a2188

Browse files
authored
Skip the animation for powershell ide (#8947)
1 parent bd5856e commit f6a2188

File tree

5 files changed

+25
-10
lines changed

5 files changed

+25
-10
lines changed

src/vme/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ Release History
1919
1.0.0b4
2020
++++++
2121
* Add '--force' to 'az vme uninstall' to force delete extension.
22+
23+
1.0.0b5
24+
++++++
25+
* Skip running animation if stdout is not a TTY.

src/vme/README.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@ az extension add --name vme
1313
### Included Features
1414
#### Install version managed extensions with default configurations
1515
```
16-
az vme install --resource-group my-rg --name my-cluster --include all
16+
az vme install --resource-group my-rg --cluster-name my-cluster --include all
17+
```
18+
19+
#### List version managed extensions
20+
```
21+
az vme list --resource-group my-rg --cluster-name my-cluster --output table
1722
```
1823

1924
#### Uninstall version managed extensions
2025
```
21-
az vme uninstall --resource-group my-rg --name my-cluster --include all
26+
az vme uninstall --resource-group my-rg --cluster-name my-cluster --include all
2227
```
2328

2429
#### Check version managed extensions' upgrade status
2530
```
26-
az vme upgrade --resource-group my-rg --name my-cluster --wait
31+
az vme upgrade --resource-group my-rg --cluster-name my-cluster --wait
2732
```

src/vme/azext_vme/custom.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def install_vme(
5151
continue
5252
except ResourceNotFoundError:
5353
# The extension does not exist, proceed with installation
54-
print(f"Installing extension {extension_type}...")
54+
print(f"Installing extension {extension_type}...", flush=True)
5555
command = [
5656
str(shutil.which("az")),
5757
"k8s-extension",
@@ -70,7 +70,7 @@ def install_vme(
7070
"cluster"
7171
]
7272
result = utils.call_subprocess_raise_output(command)
73-
print(f"Installed extension {extension_type} successfully.")
73+
print(f"Installed extension {extension_type} successfully.", flush=True)
7474
print(result)
7575

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

9898
# Uninstall the bundle extensions one by one
9999
for extension_type in include_extension_types:
100-
print(f"Uninstalling extension {extension_type}...")
100+
print(f"Uninstalling extension {extension_type}...", flush=True)
101101
command = [str(shutil.which("az")),
102102
"k8s-extension",
103103
"delete",
@@ -113,7 +113,7 @@ def uninstall_vme(
113113
if force:
114114
command.append("--force")
115115
utils.call_subprocess_raise_output(command)
116-
print(f"Uninstalled extension {extension_type} successfully.")
116+
print(f"Uninstalled extension {extension_type} successfully.", flush=True)
117117
if len(include_extension_types) > 1:
118118
print("All extensions uninstalled successfully.")
119119

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

148148
client = cf_deployments(cmd.cli_ctx, subscription_id)
149149

@@ -167,7 +167,7 @@ def upgrade_vme(
167167
f"[{timestamp}] The current deployment {deployment_name} is for {deployment_agent_version} "
168168
f"instead of current agent version {agent_version}. {consts.UPGRADE_NOTSTARTED_MSG}"
169169
)
170-
print(msg)
170+
print(msg, flush=True)
171171
time.sleep(consts.UPGRADE_CHECK_INTERVAL)
172172
continue
173173
if utils.check_deployment_status(resources, deployment, timestamp):

src/vme/azext_vme/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
logger = get_logger(__name__)
1818

1919

20+
def supports_animation():
21+
return sys.stdout.isatty()
22+
23+
2024
class PollingAnimation:
2125
def __init__(self):
2226
self.tickers = ["/", "|", "\\", "-", "/", "|", "\\", "-"]
@@ -53,6 +57,8 @@ def call_subprocess_raise_output(cmd: list, logcmd: bool = False, logstatus: boo
5357
# Log the command to be run, but do not log the password.
5458
print(f"Running command: {' '.join(log_cmd)}")
5559

60+
if not supports_animation():
61+
logstatus = False
5662
if logstatus:
5763
animation = PollingAnimation()
5864
spinner_thread = threading.Thread(target=animation.tick)

src/vme/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from setuptools import setup, find_packages
1111

1212
# HISTORY.rst entry.
13-
VERSION = '1.0.0b4'
13+
VERSION = '1.0.0b5'
1414

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

0 commit comments

Comments
 (0)