I am trying to run a script that is trying to install modules on a centos7 system using puppet control. I want to implement a progress bar for an installation that runs while the script is running. For this, I use the tqdm module. this is clarity in how I implemented the module:
from tqdm import tqdm for i in tqdm(commands): res = run_apply(i)
Here run_apply () is a function that actually handles the execution and applies the puppet configuration.
So far so good, I get a progress bar, but it continues to move around the console when progress messages are written to the console. But I need the progress bar to stay constant at the bottom of the console and dynamically update if the start messages do not interfere with the bar. I want the messages related to execution to continue on the console as they want, but the progress bar should stay there from the beginning to the end of the execution.
Below I see:
File line: 0.00 Package: 0.05 Service: 0.19 File: 0.23 Exec: 0.23 Last run: 1470308227 Config retrieval: 3.90 Total: 4.60 Version: Config: 1470308220 Puppet: 3.7.3 now here x result: 2 38%|█████████████████████████████████████▋ | 5/13 [00:29<00:51, 6.44s/it]about to: profiles::install::download_packages about to run puppet apply --summarize --detailed-exitcodes --certname puppet -e "include profiles::install::download_packages" Error: Could not find class profiles::install::download_packages for puppet on node puppet Error: Could not find class profiles::install::download_packages for puppet on node puppet now here x result: 1 46%|█████████████████████████████████████████████▏ | 6/13 [00:32<00:36, 5.27s/it]about to: profiles::install::install about to run puppet apply --summarize --detailed-exitcodes --certname puppet -e "include profiles::install::install" Error: Could not find class profiles::install::install for puppet on node puppet Error: Could not find class profiles::install::install for puppet on node puppet now here x result: 1 54%|████████████████████████████████████████████████████▊ | 7/13 [00:34<00:26, 4.45s/it]about to: stx_network about to run puppet apply --summarize --detailed-exitcodes --certname puppet -e "include stx_network" Notice: Compiled catalog for puppet in environment production in 0.84 seconds Notice: /Stage[main]/Stx_network/Tidy[purge unused nics]: Tidying File[/etc/sysconfig/network-scripts/ifcfg-lo] ...
Please let me know how I can achieve what I want.
source share