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

Unbreak swap facts on OpenBSD #58155

Closed
wants to merge 8 commits into from

Conversation

jasperla
Copy link
Contributor

@jasperla jasperla commented Aug 7, 2020

What does this PR do?

It fixes two issues:

  • on systems without swap the minion would crash attempting to gather the grains:
      File "/usr/local/lib/python3.8/site-packages/salt/grains/core.py", line 534, in _bsd_memdata
            grains["swap_total"] = int(swap_total) // 1024 // 1024
            ValueError: invalid literal for int() with base 10: 'no'
  • additionally the swap_total fact was broken for systems which did have swap as it was divided by 1024 too many.

Previous Behavior

Minion crash or incorrect swap_total.

New Behavior

No more crash and correct swap_total.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

@jasperla jasperla requested a review from a team as a code owner August 7, 2020 19:46
@ghost ghost requested review from garethgreenaway and removed request for a team August 7, 2020 19:46
In doing so it turns out swap_total was also broken on OpenBSD.
The output of `swapctl` is not identical between NetBSD and OpenBSD,
which resulted in a crashing minion:

  File "/usr/local/lib/python3.8/site-packages/salt/grains/core.py", line 534, in _bsd_memdata
        grains["swap_total"] = int(swap_total) // 1024 // 1024
	ValueError: invalid literal for int() with base 10: 'no'
While here remove unneeded salt.utils.path.which() call for swapctl
as it's always installed as /sbin/swapctl
@jasperla
Copy link
Contributor Author

Let's close this, I have lost all interest so it's not fair to keep this open any longer.

@jasperla jasperla closed this Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants