Skip to content
This repository

fix crash bug in linux_sysctl.assign() on Virtuozzo containers #635

Merged
merged 1 commit into from about 2 years ago

2 participants

0xDEC0DE Jeff Schroeder
0xDEC0DE

On systems like Virtuozzo containers, "sysctl -w" is not allowed, ever, and will fail with EPERM errors even if one is root. Since assign() doesn't check exit status or the returned string, this leads to a nasty-looking stack trace.

fix crash bug in linux_sysctl.assign() on Virtuozzo containers
On systems like Virtuozzo containers, "sysctl -w" is not allowed,
ever, and will fail with ENOPERM errors even if one is root.  Since
assign() doesn't check exit status or the returned string, this
leads to a nasty stack trace.
4e1c367
Jeff Schroeder SEJeff merged commit af7ea3d into from February 03, 2012
Jeff Schroeder SEJeff closed this February 03, 2012
Jeff Schroeder
Collaborator

It was good seeing you last night @ Corey's talk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Feb 03, 2012
fix crash bug in linux_sysctl.assign() on Virtuozzo containers
On systems like Virtuozzo containers, "sysctl -w" is not allowed,
ever, and will fail with ENOPERM errors even if one is root.  Since
assign() doesn't check exit status or the returned string, this
leads to a nasty stack trace.
4e1c367
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 0 deletions. Show diff stats Hide diff stats

  1. 2  salt/modules/linux_sysctl.py
2  salt/modules/linux_sysctl.py
@@ -65,6 +65,8 @@ def assign(name, value):
65 65
     cmd = 'sysctl -w {0}={1}'.format(name, value)
66 66
     ret = {}
67 67
     out = __salt__['cmd.run'](cmd).strip()
  68
+    if ' = ' not in out:
  69
+        raise CommandExecutionError('sysctl -w failed: {0}'.format(out))
68 70
     comps = out.split(' = ')
69 71
     ret[comps[0]] = comps[1]
70 72
     return ret
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.