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

Support zfs_pool and zfs_dataset resources on Linux #5075

Closed
mattjmcnaughton opened this issue Jun 5, 2020 · 4 comments
Closed

Support zfs_pool and zfs_dataset resources on Linux #5075

mattjmcnaughton opened this issue Jun 5, 2020 · 4 comments
Labels
Component: Core Resources Resources shipped with InSpec. Type: Enhancement Improves an existing feature

Comments

@mattjmcnaughton
Copy link

mattjmcnaughton commented Jun 5, 2020

Would y'all be open to removing the restriction that only allows the zfs_pool and zfs_dataset commands to run on FreeBSD? With the advent of ZFS on Linux (particularly its inclusion in Ubuntu 20.04), I imagine it'll see greater and greater Linux adoption. It'd be great if folks running ZFS on Linux could use the Inspec ZFS Resources.

Detailed Description

If folks using Linux can't use the zfs_pool and zfs_dataset, but still want to test ZFS resources, they are left using command, which is less readable and wasted effort.

Context

My personal use case is that I'm deploying ZFS on some Ubuntu 20.04 machines, and want to test my provisioning via Inspec using the built in zfs_pool and zfs_dataset resources.

Possible Implementation

The first step would be removing the guard against any OS other than FreeBSD here. We may also want to start using which to identify the zfs/zpool binaries, instead of relying on /sbin/zfs. I think that the ideas presented in #3800 could serve as a starting point.

If y'all are open to this feature, I'm happy to try and implement. Also, happy to have someone else implement it :)

Thanks so much for the great software - Inspec has made testing my infra a joy!

Aha! Link: https://chef.aha.io/features/SH-2190

mattjmcnaughton added a commit to mattjmcnaughton/self-hosted that referenced this issue Jun 6, 2020
Add more components of the `zfs-nas` role. Specifically, add the
components that actually create the `zpool` and `zfs datasets`.

The `zfs` support is ok... we can create datasets via Ansible, but not
zpool. W.r.t. inspec, we need to use command, as we can't use the
`inspec` ZFS resources. See inspec/inspec#5075
for more details.
@james-stocks
Copy link
Contributor

Hi @mattjmcnaughton -
Thank you for the kind feedback and this detailed description.

I think your analysis is right, what is needed is:

  1. Remove the unless condition that restricts zfs resources to BSD.
  2. Test carefully on a host that might have zfs but currently doesn't - need to ensure there are no unhandled exceptions. Resources should just return nil/false when they don't exist on the target host.
  3. Handle zfs not always being /sbin/zfs

@james-stocks james-stocks added Component: Core Resources Resources shipped with InSpec. Type: Enhancement Improves an existing feature labels Jun 8, 2020
@mattjmcnaughton
Copy link
Author

mattjmcnaughton commented Jun 9, 2020 via email

@james-stocks
Copy link
Contributor

If you get a chance, that would be great, thank you! You could set yourself as assignee so anyone else reviewing this issue sees that someone is already looking into the implementation.

Cheers!

kannanr added a commit to kannanr/inspec that referenced this issue May 15, 2021
kannanr added a commit to kannanr/inspec that referenced this issue May 15, 2021
kannanr added a commit to kannanr/inspec that referenced this issue May 15, 2021
clintoncwolfe added a commit that referenced this issue May 16, 2021
Support zfs_pool and zfs_dataset resources on Linux. Handled #5075
@clintoncwolfe
Copy link
Contributor

Added on #5523

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Resources Resources shipped with InSpec. Type: Enhancement Improves an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants