Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/ecnconfig
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class EcnConfig(object):
return result

def set_wred_threshold(self, profile, threshold, value):
if os.geteuid() != 0:
if os.geteuid() != 0 and os.environ.get("UTILITIES_UNIT_TESTING", "0") != "2":
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract lines into a function?

        if os.geteuid() != 0 and os.environ.get("UTILITIES_UNIT_TESTING", "0") != "2":
            sys.exit("Root privileges required for this operation")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

sys.exit("Root privileges required for this operation")

field = WRED_CONFIG_FIELDS[threshold]
Expand All @@ -179,7 +179,7 @@ class EcnConfig(object):
json.dump(prof_table, fd)

def set_wred_prob(self, profile, drop_color, value):
if os.geteuid() != 0:
if os.geteuid() != 0 and os.environ.get("UTILITIES_UNIT_TESTING", "0") != "2":
sys.exit("Root privileges required for this operation")

field = WRED_CONFIG_FIELDS[drop_color]
Expand Down Expand Up @@ -227,7 +227,7 @@ class EcnQ(object):
)

def set(self, enable):
if os.geteuid() != 0:
if os.geteuid() != 0 and os.environ.get("UTILITIES_UNIT_TESTING", "0") != "2":
sys.exit("Root privileges required for this operation")
for queue in self.queues:
if self.verbose:
Expand Down