-
Notifications
You must be signed in to change notification settings - Fork 71
Pre-installation checks #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
cf9fb11
[service] Add a method to validate the users service
imobachgs a453b91
[service] Add a D-Bus Validation1 interface
imobachgs a75cae3
[service] Add a WithValidation mixin for clients
imobachgs baf216f
[service] Add validation to the users service
imobachgs 67be61f
[web] Add a WithValidation mixin
imobachgs 2aa4481
[web] Extend the UsersClient with validation
imobachgs 1102718
[service] Add a CanInstall method the manager service
imobachgs f33ed95
[web] Add a canInstall function to ManagerClient
imobachgs a9df5ab
[web] Fix a typo in mixins.js
imobachgs e001025
[web] Display validation errors
imobachgs adc9616
[service] Do not install if the configuration is not valid
imobachgs ccd17f7
[service] Add validation to the storage service
imobachgs 2a9509d
[web] Extend the StorageClient with validation
imobachgs 134db17
[web] Use the validation mechanism to handle storage errors
imobachgs 90a7313
[service] Make RuboCop happy
imobachgs e99e0a7
[web] Fix pop-up title when cannot install
imobachgs cc304ea
[service] Rename IsValid to Valid
imobachgs dac7a48
[service] Describe the Validation1 interface.
imobachgs 2c6530c
[web] Add type annotations to the installer client
imobachgs 50d58cb
[web] Move InstallButton to its own file
imobachgs 1dc3aac
[web] Rewrite the component to show validation errors
imobachgs 4fc8db1
[web] Use ValidationErrors in users and storage sections
imobachgs b902536
[web] Remove the old errors list
imobachgs 27f5d12
[web] Extend Storage component unit tests
imobachgs c3eab71
[web] Fix InstallButton text
imobachgs 5d7f758
[web] Improve the presentation of validation errors
imobachgs 4cdc27a
[service] Improve the "missing user/root password" error
imobachgs 0ef1b41
[service] Rename ValidationErrors to Errors
imobachgs d4bc7cf
[web] Rename ValidationErrors to Errors
imobachgs 14f0233
Merge branch 'master' into pre-install-checks
imobachgs 0a282d4
Merge branch 'master' into pre-install-checks
imobachgs 93b99e8
[service] Fix dbus/storage/proposal tests
imobachgs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,3 @@ DEPENDENCIES | |
| simplecov (~> 0.21.2) | ||
| simplecov-lcov (~> 0.8.0) | ||
| yard (~> 0.9.0) | ||
|
|
||
| BUNDLED WITH | ||
| 2.3.3 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # 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 "dinstaller/validation_error" | ||
|
|
||
| module DInstaller | ||
| module DBus | ||
| # Mixin to include in the clients of services that implement the Validation1 interface | ||
| module WithValidation | ||
| VALIDATION_IFACE = "org.opensuse.DInstaller.Validation1" | ||
| private_constant :VALIDATION_IFACE | ||
|
|
||
| # Returns the validation errors | ||
| # | ||
| # @return [Array<ValidationError>] Validation errors | ||
| def errors | ||
| dbus_object[VALIDATION_IFACE]["Errors"].map do |message| | ||
| DInstaller::ValidationError.new(message) | ||
| end | ||
| end | ||
|
|
||
| # Determines whether the service settings are valid or not | ||
| # | ||
| # @return [Boolean] true if the service has valid data; false otherwise | ||
| def valid? | ||
| dbus_object[VALIDATION_IFACE]["Valid"] | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # 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 "dbus" | ||
|
|
||
| module DInstaller | ||
| module DBus | ||
| module Interfaces | ||
| # Mixin to define the Validation D-Bus interface | ||
| # | ||
| # @example Update the validation on a D-Bus call | ||
| # class Backend | ||
| # def validate | ||
| # ["Some error"] | ||
| # end | ||
| # end | ||
| # | ||
| # class Demo < DInstaller::DBus::BaseObject | ||
| # include DInstaller::DBus::Interfaces::Validation | ||
| # | ||
| # dbus_interface "org.opensuse.DInstaller.Demo1" do | ||
| # dbus_reader :errors, "as", dbus_name: "Errors" | ||
| # dbus_method :Foo, "out result:u" do | ||
| # # do some stuff | ||
| # update_validation # run this method is the validation can change | ||
imobachgs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # 0 | ||
| # end | ||
| # end | ||
| # end | ||
| # | ||
| # @note This mixin is expected to be included in a class that inherits from {DBus::BaseObject} | ||
| # and it requires a #backend method that returns an object that implements a #validate method. | ||
| module Validation | ||
| VALIDATION_INTERFACE = "org.opensuse.DInstaller.Validation1" | ||
|
|
||
| # D-Bus properties of the Validation1 interface | ||
| # | ||
| # @return [Hash] | ||
| def validation_properties | ||
| interfaces_and_properties[VALIDATION_INTERFACE] | ||
| end | ||
|
|
||
| # Updates the validation and raise the `PropertiesChanged` signal | ||
| def update_validation | ||
| @errors = nil | ||
| dbus_properties_changed(VALIDATION_INTERFACE, validation_properties, []) | ||
| end | ||
|
|
||
| # Returns the validation errors | ||
| # | ||
| # @return [Array<String>] Validation error messages | ||
| def errors | ||
| @errors ||= backend.validate.map(&:message) | ||
| end | ||
|
|
||
| # Determines whether the service settings are valid or not | ||
| # | ||
| # @return [Boolean] true if the service has valid data; false otherwise | ||
| def valid? | ||
| errors.empty? | ||
| end | ||
|
|
||
| def self.included(base) | ||
| base.class_eval do | ||
| dbus_interface VALIDATION_INTERFACE do | ||
| dbus_reader :errors, "as", dbus_name: "Errors" | ||
imobachgs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| dbus_reader :valid?, "b", dbus_name: "Valid" | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.