Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first pass at collecting command output for demo #977

Merged
merged 3 commits into from
Aug 25, 2016

Conversation

vjeffrey
Copy link

@vjeffrey vjeffrey commented Aug 25, 2016

heya peoples can you take a look and let me know what you think of this?? we would want the files to actually be saved somewhere in the www/ folder that the demo branch will introduce and then pull them in with the html....so i would need to make sure this overwrites too -- but i wanted to make sure something like this would be ok??. thank ya :)

@@ -0,0 +1,13 @@
# encoding: utf-8
require 'open3'
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets use https://github.com/chef/mixlib-shellout or

backend = Train.create('local', target_config)
# start or reuse a connection
conn = backend.connection
# loop around commands
cmd = conn.run_command('inspec version')
cmd.stdout
conn.close

under the hood, train is using mixlib-shellout

@chris-rock
Copy link
Contributor

@Vj this looks great, lets just switch the libs, running it via train would allow us build a predefined container that is including the latest inspec later. This would make results consistent across operating systems and CI pipelines.

@chris-rock
Copy link
Contributor

Once we have the basic commands covered, LGTM

@vjeffrey
Copy link
Author

@chris-rock updated to use train

@chris-rock
Copy link
Contributor

Thanks @vjeffrey for this great improvement! I'll create a ticket for another iteration :-)

@chris-rock chris-rock merged commit e91b885 into master Aug 25, 2016
@chris-rock chris-rock deleted the vj/get-command-output branch August 25, 2016 16:07
@chris-rock chris-rock modified the milestone: 0.32.0 Aug 25, 2016
# loop around commands
cmd = conn.run_command(command)
cmd.stdout
conn.close
Copy link
Contributor

Choose a reason for hiding this comment

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

move

backend = Train.create('local')
conn = backend.connection

and conn.close out of the loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants