-
Notifications
You must be signed in to change notification settings - Fork 680
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 correct supports platform
to resources.
#2674
Conversation
Signed-off-by: Miah Johnson <miah@chia-pet.org>
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.
Thanks @miah , This is looking really nice!
lib/resources/apache_conf.rb
Outdated
|
||
require 'utils/simpleconfig' | ||
require 'utils/find_files' | ||
|
||
module Inspec::Resources | ||
class ApacheConf < Inspec.resource(1) | ||
name 'apache_conf' | ||
supports platform: 'unix' |
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.
Since we already have os_family here defined lets update it to be:
supports platform: 'linux'
supports platform: 'debian'
instead of unix, and remove the os_family's
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.
alright
lib/resources/filesystem.rb
Outdated
@@ -1,6 +1,7 @@ | |||
module Inspec::Resources | |||
class FileSystemResource < Inspec.resource(1) | |||
name 'filesystem' | |||
supports platform: 'unix' |
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.
same here change this to linux and remove the os_family one
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.
got it
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 this is a solid platform to start with supports. We can move more restricted later but this will keep them from erroring when used with api's.
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 it is okay to add supports for unix
+ windows
for now, but we need to follow up and add the real support to the resource and remove the checks from initialize.
|
||
# Parses a csv document | ||
# This implementation was inspired by a blog post | ||
# @see http://technicalpickles.com/posts/parsing-csv-with-ruby | ||
module Inspec::Resources | ||
class CsvConfig < JsonConfig | ||
name 'csv' | ||
supports platform: 'unix' |
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 need to be careful, since unix and windows is not covering all operating systems. Even we have esx and cisco not being part of unix right now. While thinking about it, we may should fix that in our train config...
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.
For now lets add:
platform: 'esx'
platform: 'cisco'
To csv, json, and yaml. Once the OS changes go out here inspec/train#261 we can change them to 'os'. But I don't want to force out a detect change this close to 2.0 release.
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've added this to the PR.
lib/resources/iptables.rb
Outdated
@@ -24,6 +22,7 @@ | |||
module Inspec::Resources | |||
class IpTables < Inspec.resource(1) | |||
name 'iptables' | |||
supports platform: 'unix' |
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.
This would need to be 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.
Fixed
@@ -1,11 +1,11 @@ | |||
# encoding: utf-8 | |||
# author: Jen Burns, burnsjennifere@gmail.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.
Have we agreed somewhere that we remove the author headers?
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.
Yes, github accurately keeps history of authors. This is not the main focus of this PR but is being included for now.
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.
Lets try to keep a PR focused on one thin in the future
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.
No problem, our Team Working Agreement states that we should remove these when the file is touched so thats what I did.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
Signed-off-by: Jared Quick <jquick@chef.io>
@chris-rock - I think this is in a pretty safe spot now with the new changes. |
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.
@miah @jquick This is good for a first pass. As a next iteration, we need to focus on:
- update train to reflect os
- clean up the supports logic for resources and move that out of the initialize method
- some resources do not work on unix but only on linux, we need to be more accurate. It works right now, since we have the supports logic still in initialize
The PR updates all the resources to specify their supported platforms.
Fixes #2661