Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warning messages with resizing is not possible
- Loading branch information
Showing
8 changed files
with
248 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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 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 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,61 @@ | ||
# encoding: utf-8 | ||
|
||
# Copyright (c) [2017] 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 "y2storage/autoinst_issues/issue" | ||
|
||
module Y2Storage | ||
module AutoinstIssues | ||
# Represents an AutoYaST situation where an invalid value was given. | ||
# | ||
# @example Invalid value 'auto' for attribute :size on /home partition | ||
# section = AutoinstProfile::PartitioningSection.new_from_hashes({"size" => "auto"}) | ||
# problem = InvalidValue.new(section, :size) | ||
# problem.value #=> "auto" | ||
# problem.attr #=> :size | ||
class NotResizable < Issue | ||
# @return [String] Name of the device that cannot be resized | ||
attr_reader :device | ||
|
||
# @param section [#parent,#section_name] Section where it was detected (see {AutoinstProfile}) | ||
# @param device [String] Name of the device that cannot be resized | ||
def initialize(section, device) | ||
@section = section | ||
@device = device | ||
end | ||
|
||
# Return problem severity | ||
# | ||
# @return [Symbol] :warn | ||
def severity | ||
:warn | ||
end | ||
|
||
# Return the error message to be displayed | ||
# | ||
# @return [String] Error message | ||
# @see Issue#message | ||
def message | ||
# TRANSLATORS: kernel device name (eg. '/dev/sda1') | ||
_("Device '%s' cannot be resized.") % device | ||
end | ||
end | ||
end | ||
end |
This file contains 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 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 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,46 @@ | ||
#!/usr/bin/env rspec | ||
# encoding: utf-8 | ||
|
||
# Copyright (c) [2017] 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_relative "../../spec_helper" | ||
require "y2storage/autoinst_issues/not_resizable" | ||
|
||
describe Y2Storage::AutoinstIssues::NotResizable do | ||
subject(:issue) { described_class.new(section, "/dev/sda1") } | ||
|
||
let(:section) do | ||
instance_double(Y2Storage::AutoinstProfile::PartitionSection) | ||
end | ||
|
||
let(:device_name) { nil } | ||
|
||
describe "#message" do | ||
it "returns a description including the device name" do | ||
expect(issue.message).to eq("Device '/dev/sda1' cannot be resized.") | ||
end | ||
end | ||
|
||
describe "#severity" do | ||
it "returns :warn" do | ||
expect(issue.severity).to eq(:warn) | ||
end | ||
end | ||
end |
This file contains 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.