-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add detection for Arista EOS #158
Conversation
Signed-off-by: Jere Julian <jere@arista.com>
Signed-off-by: Jere Julian <jere@arista.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks @jerearista
unless output.empty? | ||
eos_ver = JSON.parse(output) | ||
@platform[:name] = @platform[:name] || 'arista_eos' | ||
family ||= 'arista_eos' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we not using fedora
in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you are in the bash shell, then you can do all the fedora things. However, when you login the way you would to a typical running switch, you are in a custom EOS CLI. You can still prefix linux commands with 'bash' from this mode but common commands are things like 'show running-config', 'show interfaces status', etc. Thus, things that expect to be in a regular linux shell will need special handling.
I'm definitely willing to go another route, if appropriate.
You can test yourself by registering at http://Arista.com/, then going to Software Downloads --> vEOS and downloading the files for your preferred hypervisor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should use arista_eos
as the family for both instead of fedora?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed that more resources would adapt their behavior based on :family but since that's not the case, I'm fine with setting both to arista_eos
if you think that's best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to count EOS as linux, we should also add it to https://github.com/chef/train/blob/master/lib/train/extras/os_common.rb#L68 because most resources go with inspec.os.linux?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about this a bit. If we always mark EOS as family: arista_eos and include that as "linux", then resources will fail instead of skipping when we're in the usual CLI mode unless from the os detection I can specify to default to prefixing all linux commands with bash
to drop to a linux shell (Ex: bash uname -a
or bash sudo cat /etc/passwd
).
Alternatively, I could just patch up the resources as we make use of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we make bash
default and use the EOS CLI only withinEOS specific InSpec resources. Is bash available on all devices?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could achieve that by implementing a specific command wrapper for eos https://github.com/chef/train/blob/master/lib/train/extras/command_wrapper.rb#L164-L175
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that will work. I'm not sure I'll get the wrapper in by Friday but I don't think that needs to hold up the initial platform support. So, to recap, I'll set the family to arista_eos
for both cases and we can improve handling the differences with a command wrapper.
Thanks @jerearista Lets cover the other improvements in another PR |
Note: EOS has 2 possible modes: the network CLI and a bash shell, typically only accessed in a test scenario such as with Vagrant.