From c9e7541e60b072bbc518d134490fac0192f1373a Mon Sep 17 00:00:00 2001
From: Tom Dymond <tom@anobii.com>
Date: Wed, 5 Feb 2014 15:35:24 +0000
Subject: [PATCH] Reworked PR to avoid repeating the command

---
 system/sysctl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/system/sysctl b/system/sysctl
index d323f2dde73..97e5bc5e6c1 100644
--- a/system/sysctl
+++ b/system/sysctl
@@ -220,10 +220,11 @@ class SysctlModule(object):
             rc,out,err = self.module.run_command('/etc/rc.d/sysctl reload')
         else:
             # system supports reloading via the -p flag to sysctl, so we'll use that
+            sysctl_args = [self.sysctl_cmd, '-p', self.sysctl_file]
             if self.args['ignoreerrors']:
-                rc,out,err = self.module.run_command([self.sysctl_cmd, '-e', '-p', self.sysctl_file])
-            else:
-                rc,out,err = self.module.run_command([self.sysctl_cmd, '-p', self.sysctl_file])
+                sysctl_args.insert(1, '-e')
+            
+            rc,out,err = self.module.run_command(sysctl_args)
 
         if rc != 0:            
             self.module.fail_json(msg="Failed to reload sysctl: %s" % str(out) + str(err))