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

(FACT-3163) Add support for OpenBSD #2531

Merged
merged 1 commit into from
Nov 4, 2023
Merged

Conversation

buzzdeee
Copy link
Contributor

Most inspiration taken from FreeBSD, rest from other OS, and some own creations. Not all core facts supported, but makes puppet facts works well, as well as puppet agent --test

Developed/Tested on OpenBSD 7.2, AMD64, Puppet 7.20.0, Ruby 3.1.2

also disable RuboCop Metrics/PerceivedComplexity
and Metrics/CyclomaticComplexity
as suggested by @joshcooper

@buzzdeee buzzdeee requested a review from a team as a code owner October 26, 2022 19:53
@puppetlabs-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@buzzdeee
Copy link
Contributor Author

new after messing up: #2529 #2529

@buzzdeee buzzdeee force-pushed the master branch 2 times, most recently from ab7f9fe to 48af4a5 Compare October 26, 2022 21:14
@joshcooper
Copy link
Contributor

I think the CI failures are due to a change in behavior with rspec-mocks. We had a similar problem in puppet, so I'll take a look.

@joshcooper
Copy link
Contributor

Thanks @buzzdeee I committed a change to fix a test issue with rspec-mocks. Could you fetch the latest changes from https://github.com/puppetlabs/facter#main, rebase your changes on top and force push to your topic branch?

@buzzdeee buzzdeee force-pushed the master branch 2 times, most recently from 07d3ec6 to e0616ac Compare November 8, 2022 13:13
@buzzdeee
Copy link
Contributor Author

buzzdeee commented Nov 8, 2022

thanks @joshcooper
yay, all checks passed.

give me a bit, and I'll look into the unit tests

@joshcooper
Copy link
Contributor

Hi @buzzdeee this is great, thanks so much! Last housekeeping items is to prefix the summary for each commit with (FACT-3163) and squash "trying this out" kind of commits. Easiest thing is squash it into one commit and force push to your feature branch:

$ git reset e0616ac43
$ git add .
$ git commit --amend --no-edit
$ git push --force origin HEAD

@buzzdeee
Copy link
Contributor Author

yeah, going to squash them, once I'm done with it, I'll let you know when I think I'm good (:

@buzzdeee buzzdeee force-pushed the master branch 10 times, most recently from 6208a4e to b4302d4 Compare November 12, 2022 20:18
@buzzdeee
Copy link
Contributor Author

@joshcooper I think I'm done.

All OpenBSD facts have tests, and all but the dhcp resolver. I didn't implement a full Module/Class there, only subclassed Facter::Resolvers::Networking and override the extract_dhcp method. There I don't know how to properly test it, I made a number of different attempts, but all failed in various ways.

other changes from initial PR:

  • add system_uptime facts I forgot
  • fix networking.dhcp fact
  • case insensitive match in facter/framework/detector/os_detector.rb

the last one I needed because when facter is installed with puppetserver gem install facter, it returned OpenBSD and it just didn't matched it. My final goal is to get puppetserver to run on OpenBSD to replace my dated puppet master based on puppet 5.

@klemensn
Copy link

It would be great to get this landed so we can finish up Puppet 7 (and eventually retire 5) on OpenBSD.

@bigio
Copy link

bigio commented Feb 12, 2023

I am currently running Puppetserver 7.9.2 on OpenBSD with this diff in production and it's working fine.
Having this committed will ease the move to Puppet7 on OpenBSD.

@CLAassistant
Copy link

CLAassistant commented Apr 19, 2023

CLA assistant check
All committers have signed the CLA.

@buzzdeee buzzdeee force-pushed the master branch 2 times, most recently from 7dca95e to 2fa8568 Compare October 21, 2023 18:52
@buzzdeee buzzdeee force-pushed the master branch 3 times, most recently from 5dfc61c to 7bbd55b Compare October 21, 2023 19:26
Most inspiration taken from FreeBSD, rest from other OS,
and some own creations. Not all core facts supported, but
makes puppet facts works well, as well as puppet agent --test

Developed/Tested on OpenBSD 7.2, AMD64, Puppet 7.20.0, Ruby 3.1.2

also disable RuboCop Metrics/PerceivedComplexity
and Metrics/CyclomaticComplexity
as suggested by @joshcooper

Additionally:
Case insensitive OS detection

ran into trouble when facter installed via puppetserver gem install,
there the OS returned seems to be OpenBSD instead of all lowercase.
@buzzdeee
Copy link
Contributor Author

with the file loading change to 4.4, this was quite a hurdle to find.
updated to the latest, seems to all working.
It would be really great to get this landed.

Also wondering why the FACTER queue in Jira is archived?

@joshcooper joshcooper merged commit e6cee0a into puppetlabs:main Nov 4, 2023
19 checks passed
@joshcooper
Copy link
Contributor

Thanks for you work on this @buzzdeee!

@joshcooper joshcooper added the enhancement New feature or enhancement label Nov 15, 2023
@joshcooper
Copy link
Contributor

Sorry but this introduced order dependent spec failures and had to be reverted. You can reproduce the failure using:

$ rspec -fd './spec/facter/resolvers/openbsd/virtual_spec.rb[1:2:1]' './spec/facter/util/facts/posix/virtual_detector_spec.rb[1:1:12:1]' --order random:17181

@buzzdeee
Copy link
Contributor Author

I'm looking

@buzzdeee
Copy link
Contributor Author

Hi @joshcooper

thanks for the rspec line to reproduce the issue.

with a certainty of about 80% I understand what went wrong, and tried to address it in #2642

@joshcooper joshcooper added maintenance Maintenance chores are excluded from changelogs and removed enhancement New feature or enhancement labels Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance chores are excluded from changelogs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants