summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormwrock <matt@mattwrock.com>2020-12-08 16:04:27 -0800
committermwrock <matt@mattwrock.com>2020-12-08 16:04:27 -0800
commitd2303a7aca2e4d0d9226cd7d81b9510d7e05d3f2 (patch)
treee40b02fe78dda8f50fe8dee8e11b72b194a360f8
parent941c5921c5e9ea8d9ca3b692233c08015d710eca (diff)
downloadchef-d2303a7aca2e4d0d9226cd7d81b9510d7e05d3f2.tar.gz
sdfsd
Signed-off-by: mwrock <matt@mattwrock.com>
-rw-r--r--lib/chef/provider/systemd_unit.rb10
-rw-r--r--omnibus/omnibus-test.ps11
-rw-r--r--spec/unit/provider/systemd_unit_spec.rb8
3 files changed, 10 insertions, 9 deletions
diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb
index 97043e48c7..1719a72f7c 100644
--- a/lib/chef/provider/systemd_unit.rb
+++ b/lib/chef/provider/systemd_unit.rb
@@ -16,6 +16,7 @@
# limitations under the License.
#
+require "pry"
require_relative "../provider"
require_relative "../mixin/which"
require_relative "../resource/file"
@@ -251,7 +252,14 @@ class Chef
end
def systemctl_execute(action, unit, **options)
- shell_out(systemctl_cmd, action, unit, **systemctl_opts.merge(options))
+ require "ruby-prof"
+ RubyProf.start
+ cmd = shell_out(systemctl_cmd, action, unit, **systemctl_opts.merge(options))
+ result = RubyProf.stop
+ printer = RubyProf::FlatPrinter.new(result)
+ printer.print(STDOUT)
+ puts "cmd: #{cmd.command}"
+ cmd
end
def systemctl_cmd
diff --git a/omnibus/omnibus-test.ps1 b/omnibus/omnibus-test.ps1
index 7dc0069fd6..99d7ffa9f0 100644
--- a/omnibus/omnibus-test.ps1
+++ b/omnibus/omnibus-test.ps1
@@ -61,6 +61,7 @@ $chefdir = Split-Path -Path "$chefdir" -Parent
$chefdir = Split-Path -Path "$chefdir" -Parent
Copy-Item ./spec/unit/provider/systemd_unit_spec.rb $chefdir/spec/unit/provider/systemd_unit_spec.rb -force
+Copy-Item ./lib/chef/provider/systemd_unit.rb $chefdir/lib/chef/provider/systemd_unit.rb -force
Copy-Item Gemfile $chefdir/Gemfile -force
Set-Location -Path $chefdir
diff --git a/spec/unit/provider/systemd_unit_spec.rb b/spec/unit/provider/systemd_unit_spec.rb
index 69298e79e0..e1170b4fc5 100644
--- a/spec/unit/provider/systemd_unit_spec.rb
+++ b/spec/unit/provider/systemd_unit_spec.rb
@@ -138,17 +138,9 @@ describe Chef::Provider::SystemdUnit do
end
it "sets the active property to false if the unit is not active" do
- $stdout.puts "starting test!!!"
- require "ruby-prof"
- RubyProf.start
allow(provider).to receive(:active?).and_return(false)
provider.load_current_resource
expect(current_resource.active).to be false
- result = RubyProf.stop
- printer = RubyProf::FlatPrinter.new(result)
- puts "printing prof results"
- printer.print(STDOUT)
- puts "done printing prof results"
end
it "should check if the unit is enabled" do