terminal-labs / rambo

A Provider Agnostic Provisioning Framework
Other
24 stars 5 forks source link

add system that emits a percentage complete int #199

Open verhulstm opened 6 years ago

verhulstm commented 6 years ago

I want a system that tracks the output of "rambo up" logging output and emits a int that represents the build progress.

This might be hard, and I can imagine several ways of doing it.

verhulstm commented 6 years ago

I think we can modify rambo/rambo/app.py at line #60 and change def _invoke_vagrant(cmd=None) to:

def _invoke_vagrant(cmd=None, progressbar=None)

and replace click.echo(data.rstrip()) with a system that writes to a str var. like: men_log = data.rstrip()

one each read step we can call a log analyzer that scans the output log looking for certain words and phrases that map build completion values.

We can pass in a json file that contains list of strings that represent a heuristic of the progress of the build.

verhulstm commented 6 years ago

the json file could look like this:

["Vagrant insecure key detected.", "default: Running provisioner: salt", "Running state [setup_basebox]", "Summary for local"]

This json file above (when processed with a ubuntu 16.04 build ) would emit the completion values: 0%, 20%, 40%, 60%, 80%, 100%.

if more heuristic expectation strings are added in then the resolution of the emitted completion values goes up.

verhulstm commented 6 years ago

we could also not include this log analyzer in rambo and offer it as a separate tool.

that way users would just pipe rambo's output into the log analyzer

rambo up | analyzer

this would allow the heuristic expectation log analyzer to be used with any other tool. very cool in and of itself.

the more i think about this the more a like it.