Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8e3f396
Add a SoftwareService
imobachgs Jun 10, 2022
93df167
Move the software client from the CLI to the service
imobachgs Jun 10, 2022
15a8cb5
Move YaST initialization to ServiceRunner
imobachgs Jun 10, 2022
a60a726
Remove D-Bus software object from manager service
imobachgs Jun 14, 2022
6d47cbf
Ask for software actions through D-Bus
imobachgs Jun 10, 2022
da95013
Do the software probing async
imobachgs Jun 16, 2022
e6be4b0
Fix typos in progress messages
imobachgs Jun 16, 2022
a11517f
Make RuboCop happy
imobachgs Jun 16, 2022
cf074aa
Add progress to the Software service
imobachgs Jun 16, 2022
641e97e
Minor documentation update
imobachgs Jun 16, 2022
5645a19
Adapt the web UI to use the new Software service
imobachgs Jun 16, 2022
528c991
Use the same approach in users and software clients
imobachgs Jun 16, 2022
44508a2
Add a missing cockpit import
imobachgs Jun 16, 2022
13de8c8
Fix CLI config command to use the new software client
imobachgs Jun 16, 2022
b49653e
Update d-installer version in Gemfile.lock files
imobachgs Jun 16, 2022
9013b1b
Update ruby-dbus dependency to 0.18.0.beta7
imobachgs Jun 16, 2022
23dcd0d
bin/d-installer starts all services
imobachgs Jun 16, 2022
5a10535
Remove line about ignored config paths
imobachgs Jun 16, 2022
5d83d68
Do not require "yast" until it is needed
imobachgs Jun 17, 2022
9d44cf8
Remove an unneeded require
imobachgs Jun 16, 2022
a67d788
Improve Clients::Software documentation
imobachgs Jun 17, 2022
b56a99b
Fix Software#propose to receive the progresss object
imobachgs Jun 17, 2022
9faed1b
Fix wrong reference to ARGV
imobachgs Jun 17, 2022
3895445
Minor documentation fixes
imobachgs Jun 17, 2022
8fc647c
Simplify Software#probe
imobachgs Jun 17, 2022
f93b4c6
DInstaller::Software owns the reporting object
imobachgs Jun 17, 2022
e79e887
Fix DInstaller::Software unit tests
imobachgs Jun 17, 2022
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
8 changes: 4 additions & 4 deletions cli/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ../service
specs:
d-installer (0.2)
d-installer (0.3)
cfa (~> 1.0.2)
cfa_grub2 (~> 2.0.0)
cheetah (~> 1.0.0)
Expand All @@ -14,8 +14,8 @@ PATH
PATH
remote: .
specs:
d-installer-cli (0.2)
d-installer (= 0.2)
d-installer-cli (0.3)
d-installer (= 0.3)
fast_gettext (~> 2.2.0)
ruby-dbus (>= 0.18.0.beta5)
thor (~> 1.2, >= 1.2.1)
Expand Down Expand Up @@ -56,7 +56,7 @@ GEM
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
ruby-augeas (0.5.0)
ruby-dbus (0.18.0.beta6)
ruby-dbus (0.18.0.beta7)
rexml
simplecov (0.21.2)
docile (~> 1.1)
Expand Down
1 change: 0 additions & 1 deletion cli/lib/dinstaller_cli/clients.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ module Clients

require "dinstaller_cli/clients/manager"
require "dinstaller_cli/clients/language"
require "dinstaller_cli/clients/software"
require "dinstaller_cli/clients/storage"
71 changes: 0 additions & 71 deletions cli/lib/dinstaller_cli/clients/software.rb

This file was deleted.

4 changes: 2 additions & 2 deletions cli/lib/dinstaller_cli/commands/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
require "dinstaller_cli/install_config"
require "dinstaller_cli/install_config_reader"
require "dinstaller_cli/clients/language"
require "dinstaller_cli/clients/software"
require "dinstaller_cli/clients/storage"
require "dinstaller/dbus/clients/software"
require "dinstaller/dbus/clients/users"

module DInstallerCli
Expand Down Expand Up @@ -135,7 +135,7 @@ def language_client
end

def software_client
@software_client ||= Clients::Software.new
@software_client ||= DInstaller::DBus::Clients::Software.new
end

def storage_client
Expand Down
25 changes: 2 additions & 23 deletions cli/lib/dinstaller_cli/commands/software.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,8 @@
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

# frozen_string_literal: true

# Copyright (c) [2022] SUSE LLC
#
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, contact SUSE LLC.
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

require "thor"
require "dinstaller_cli/clients/software"
require "dinstaller/dbus/clients/software"

module DInstallerCli
module Commands
Expand All @@ -63,7 +42,7 @@ def selected_product(id = nil)
private

def client
@client ||= Clients::Software.new
@client ||= DInstaller::DBus::Clients::Software.new
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions cli/test/dinstaller_cli/commands/config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
require "dinstaller_cli/install_config"
require "dinstaller_cli/install_config_reader"
require "dinstaller_cli/clients/language"
require "dinstaller_cli/clients/software"
require "dinstaller_cli/clients/storage"
require "dinstaller/dbus/clients/users"
require "dinstaller/dbus/clients/software"

describe DInstallerCli::Commands::Config do
before do
allow(DInstallerCli::Clients::Software).to receive(:new).and_return(software_client)
allow(DInstaller::DBus::Clients::Software).to receive(:new).and_return(software_client)
allow(DInstallerCli::Clients::Language).to receive(:new).and_return(language_client)
allow(DInstallerCli::Clients::Storage).to receive(:new).and_return(storage_client)
allow(DInstaller::DBus::Clients::Users).to receive(:new).and_return(users_client)
end

let(:software_client) { instance_double(DInstallerCli::Clients::Software) }
let(:software_client) { instance_double(DInstaller::DBus::Clients::Software) }
let(:language_client) { instance_double(DInstallerCli::Clients::Language) }
let(:storage_client) { instance_double(DInstallerCli::Clients::Storage) }
let(:users_client) { instance_double(DInstaller::DBus::Clients::Users) }
Expand Down
6 changes: 3 additions & 3 deletions cli/test/dinstaller_cli/commands/software_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@

require_relative "../../test_helper"
require "dinstaller_cli/commands/software"
require "dinstaller_cli/clients/software"
require "dinstaller/dbus/clients/software"

describe DInstallerCli::Commands::Software do
subject { described_class.new }

before do
allow(subject).to receive(:say)
allow(DInstallerCli::Clients::Software).to receive(:new).and_return(client)
allow(DInstaller::DBus::Clients::Software).to receive(:new).and_return(client)
end

let(:client) { instance_double(DInstallerCli::Clients::Software) }
let(:client) { instance_double(DInstaller::DBus::Clients::Software) }

describe "#available_products" do
before do
Expand Down
4 changes: 2 additions & 2 deletions service/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
d-installer (0.2)
d-installer (0.3)
cfa (~> 1.0.2)
cfa_grub2 (~> 2.0.0)
cheetah (~> 1.0.0)
Expand Down Expand Up @@ -51,7 +51,7 @@ GEM
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
ruby-augeas (0.5.0)
ruby-dbus (0.18.0.beta6)
ruby-dbus (0.18.0.beta7)
rexml
simplecov (0.21.2)
docile (~> 1.1)
Expand Down
44 changes: 39 additions & 5 deletions service/bin/d-installer
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,42 @@ require "rubygems"
require "bundler/setup"
require "dinstaller/dbus/service_runner"

service_name = $ARGV[0]&.to_sym || :manager
service_runner = DInstaller::DBus::ServiceRunner.new(
service_name, logger: Logger.new($stdout)
)
service_runner.run
# Runs the service with the given name
#
# @param name [Symbol] Service name
# @see ORDERED_SERVICES
def start_service(name)
logger = Logger.new($stdout, progname: name.to_s)
service_runner = DInstaller::DBus::ServiceRunner.new(
name, logger: logger
)
service_runner.run
end

ORDERED_SERVICES = [:software, :users, :manager].freeze

# Starts all the services
#
# @return [Array<Integer>] PIDs
# @see ORDERED_SERVICES
def start_all_services
ORDERED_SERVICES.map do |name|
fork { exec("#{__FILE__} #{name}") }
end
end

if ARGV.empty?
pids = start_all_services
Signal.trap("SIGINT") do
puts "Stopping all services..."
exit
end
Process.wait
else
name = ARGV[0]
Signal.trap("SIGINT") do
puts "Stopping #{name} service..."
exit
end
start_service(name.to_sym)
end
5 changes: 2 additions & 3 deletions service/lib/dinstaller/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

require "yast"
require "yaml"
require "dinstaller/config_reader"

Expand All @@ -37,8 +36,8 @@ class << self
attr_accessor :current, :base

# Loads base and current config reading configuration from the system
def load
@base = ConfigReader.new.config
def load(logger = Logger.new($stdout))
@base = ConfigReader.new(logger: logger).config
@current = @base&.copy
end

Expand Down
2 changes: 0 additions & 2 deletions service/lib/dinstaller/config_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ def file_paths_in(path)
elsif File.directory?(path)
Dir.glob("#{path}/*.{yml,yaml}")
else
logger.debug("Ignoring not valid path: #{path}")

[]
end
end
Expand Down
1 change: 1 addition & 0 deletions service/lib/dinstaller/dbus/clients.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ module Clients
end

require "dinstaller/dbus/clients/dinstaller"
require "dinstaller/dbus/clients/software"
require "dinstaller/dbus/clients/users"
Loading