Skip to content

Commit

Permalink
Do not fetch the 'TriggeredBy' property
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Aug 9, 2018
1 parent 540e72d commit 2e55506
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
7 changes: 2 additions & 5 deletions library/systemd/src/modules/systemd_service.rb
Expand Up @@ -72,7 +72,6 @@ class SystemdServiceClass < Module
include Yast::Logger

UNIT_SUFFIX = ".service".freeze
SERVICE_PROPMAP = SystemdUnit::DEFAULT_PROPMAP.merge(triggered_by: "TriggeredBy")

# @param service_name [String] "foo" or "foo.service"
# @param propmap [SystemdUnit::PropMap]
Expand Down Expand Up @@ -101,17 +100,16 @@ def find!(service_name, propmap = {})
private def find_many_at_once(service_names, propmap = {})
return [] if Stage.initial

service_propmap = SERVICE_PROPMAP.merge(propmap)
snames = service_names.map { |n| n + UNIT_SUFFIX unless n.end_with?(UNIT_SUFFIX) }
snames_s = snames.join(" ")
pnames_s = service_propmap.values.join(",")
pnames_s = SystemdUnit::DEFAULT_PROPMAP.merge(propmap).values.join(",")
out = Systemctl.execute("show --property=#{pnames_s} #{snames_s}")
log.error "returned #{out.exit}, #{out.stderr}" unless out.exit.zero? && out.stderr.empty?
property_texts = out.stdout.split("\n\n")
return [] unless snames.size == property_texts.size

snames.zip(property_texts).each_with_object([]) do |(name, property_text), memo|
service = Service.new(name, service_propmap, property_text)
service = Service.new(name, propmap, property_text)
memo << service unless service.not_found?
end
end
Expand Down Expand Up @@ -145,7 +143,6 @@ def all(propmap = {})
# @return [Service] System service with the given name
def build(service_name, propmap = {})
service_name += UNIT_SUFFIX unless service_name.end_with?(UNIT_SUFFIX)
propmap = SERVICE_PROPMAP.merge(propmap)
Service.new(service_name, propmap)
end

Expand Down
5 changes: 0 additions & 5 deletions library/systemd/test/systemd_service_test.rb
Expand Up @@ -95,11 +95,6 @@ module Yast
)
end

it "includes 'TriggeredBy' property" do
cups = SystemdService.find_many(["apparmor", "cups"]).last
expect(cups.properties.triggered_by).to eq("cups.path cups.socket")
end

context "when 'systemctl show' fails to provide services information" do
let(:systemctl_show) { OpenStruct.new(stdout: "", stderr: "", exit: 1) }

Expand Down

0 comments on commit 2e55506

Please sign in to comment.