summaryrefslogtreecommitdiff
path: root/lib/chef/provider/service
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-07-03 13:11:13 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-07-05 12:41:04 -0700
commit9802d7c075c8b7dae42dbcecd92d492f7fa128ac (patch)
tree0d13de92dc631081f9bcdaddedd6294051e3423b /lib/chef/provider/service
parent4978a9a8a402477f3b35f43404701d6a5cf26fa1 (diff)
downloadchef-9802d7c075c8b7dae42dbcecd92d492f7fa128ac.tar.gz
Style/NegatedIf
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/provider/service')
-rw-r--r--lib/chef/provider/service/openbsd.rb10
-rw-r--r--lib/chef/provider/service/upstart.rb2
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/provider/service/openbsd.rb b/lib/chef/provider/service/openbsd.rb
index 3f28e69ce3..e427606571 100644
--- a/lib/chef/provider/service/openbsd.rb
+++ b/lib/chef/provider/service/openbsd.rb
@@ -78,7 +78,7 @@ class Chef
end
def enable_service
- if !is_enabled?
+ unless is_enabled?
if is_builtin?
if is_enabled_by_default?
update_rcl rc_conf_local.sub(/^#{Regexp.escape(builtin_service_enable_variable_name)}=.*/, "")
@@ -132,7 +132,7 @@ class Chef
end
def update_rcl(value)
- FileUtils.touch RC_CONF_LOCAL_PATH if !::File.exists? RC_CONF_LOCAL_PATH
+ FileUtils.touch RC_CONF_LOCAL_PATH unless ::File.exists? RC_CONF_LOCAL_PATH
::File.write(RC_CONF_LOCAL_PATH, value)
@rc_conf_local = value
end
@@ -170,7 +170,7 @@ class Chef
var_name = builtin_service_enable_variable_name
if var_name
if m = rc_conf.match(/^#{Regexp.escape(var_name)}=(.*)/)
- if !(m[1] =~ /"?[Nn][Oo]"?/)
+ unless m[1] =~ /"?[Nn][Oo]"?/
result = true
end
end
@@ -186,12 +186,12 @@ class Chef
if var_name
if m = rc_conf_local.match(/^#{Regexp.escape(var_name)}=(.*)/)
@enabled_state_found = true
- if !(m[1] =~ /"?[Nn][Oo]"?/) # e.g. looking for httpd_flags=NO
+ unless m[1] =~ /"?[Nn][Oo]"?/ # e.g. looking for httpd_flags=NO
result = true
end
end
end
- if !@enabled_state_found
+ unless @enabled_state_found
result = is_enabled_by_default?
end
else
diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb
index d88dc4bb6f..5364053ba8 100644
--- a/lib/chef/provider/service/upstart.rb
+++ b/lib/chef/provider/service/upstart.rb
@@ -83,7 +83,7 @@ class Chef
# Do not call super, only call shared requirements
shared_resource_requirements
requirements.assert(:all_actions) do |a|
- if !@command_success
+ unless @command_success
whyrun_msg = if @new_resource.status_command
"Provided status command #{@new_resource.status_command} failed."
else