![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package yast2-storage-ng for openSUSE:Factory checked in at 2018-05-11 09:12:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-storage-ng (Old) and /work/SRC/openSUSE:Factory/.yast2-storage-ng.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-storage-ng" Fri May 11 09:12:54 2018 rev:19 rq:605710 version:4.0.178 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-storage-ng/yast2-storage-ng.changes 2018-05-06 14:58:43.571064519 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-storage-ng.new/yast2-storage-ng.changes 2018-05-11 09:13:01.337933168 +0200 @@ -1,0 +2,30 @@ +Wed May 9 08:21:50 UTC 2018 - igonzalezsosa@suse.com + +- AutoYaST: do not crash when size is set to 'auto' for a partition + without a mount point (bsc#1092414). +- 4.0.178 + +------------------------------------------------------------------- +Tue May 8 15:34:19 UTC 2018 - shundhammer@suse.com + +- Add note to YAML files for devices not supported in YAML + (part of fate#318196) +- 4.0.177 + +------------------------------------------------------------------- +Mon May 7 16:39:49 UTC 2018 - shundhammer@suse.com + +- Dump devicegraphs and actions in better strategic places + (part of fate#318196) +- Make sure not to write LUKS passwords to YAML dump files +- 4.0.176 + +------------------------------------------------------------------- +Fri May 04 18:06:41 CEST 2018 - aschnell@suse.com + +- provide function to disable MD auto assembly (bsc#1090690) +- provide function to inhibit udisks from doing mounts +- use these two functions when running expert partitioner +- 4.0.175 + +------------------------------------------------------------------- Old: ---- yast2-storage-ng-4.0.174.tar.bz2 New: ---- yast2-storage-ng-4.0.178.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-storage-ng.spec ++++++ --- /var/tmp/diff_new_pack.SVte8M/_old 2018-05-11 09:13:01.877913607 +0200 +++ /var/tmp/diff_new_pack.SVte8M/_new 2018-05-11 09:13:01.881913462 +0200 @@ -17,7 +17,7 @@ Name: yast2-storage-ng -Version: 4.0.174 +Version: 4.0.178 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -29,6 +29,8 @@ Requires: yast2-ruby-bindings >= 4.0.6 # function light_probe Requires: libstorage-ng-ruby >= 3.3.254 +# communicate with udisks +Requires: rubygem(ruby-dbus) BuildRequires: update-desktop-files # function light_probe @@ -44,6 +46,8 @@ BuildRequires: yast2-ruby-bindings >= 4.0.6 BuildRequires: rubygem(rspec) BuildRequires: rubygem(yast-rake) +# communicate with udisks +BuildRequires: rubygem(ruby-dbus) PreReq: %fillup_prereq Obsoletes: yast2-storage ++++++ yast2-storage-ng-4.0.174.tar.bz2 -> yast2-storage-ng-4.0.178.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/package/yast2-storage-ng.changes new/yast2-storage-ng-4.0.178/package/yast2-storage-ng.changes --- old/yast2-storage-ng-4.0.174/package/yast2-storage-ng.changes 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/package/yast2-storage-ng.changes 2018-05-09 12:05:41.000000000 +0200 @@ -1,4 +1,34 @@ ------------------------------------------------------------------- +Wed May 9 08:21:50 UTC 2018 - igonzalezsosa@suse.com + +- AutoYaST: do not crash when size is set to 'auto' for a partition + without a mount point (bsc#1092414). +- 4.0.178 + +------------------------------------------------------------------- +Tue May 8 15:34:19 UTC 2018 - shundhammer@suse.com + +- Add note to YAML files for devices not supported in YAML + (part of fate#318196) +- 4.0.177 + +------------------------------------------------------------------- +Mon May 7 16:39:49 UTC 2018 - shundhammer@suse.com + +- Dump devicegraphs and actions in better strategic places + (part of fate#318196) +- Make sure not to write LUKS passwords to YAML dump files +- 4.0.176 + +------------------------------------------------------------------- +Fri May 04 18:06:41 CEST 2018 - aschnell@suse.com + +- provide function to disable MD auto assembly (bsc#1090690) +- provide function to inhibit udisks from doing mounts +- use these two functions when running expert partitioner +- 4.0.175 + +------------------------------------------------------------------- Fri May 4 14:46:31 UTC 2018 - jlopez@suse.com - Partitioner: added option to import mount points (part of diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/package/yast2-storage-ng.spec new/yast2-storage-ng-4.0.178/package/yast2-storage-ng.spec --- old/yast2-storage-ng-4.0.174/package/yast2-storage-ng.spec 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/package/yast2-storage-ng.spec 2018-05-09 12:05:41.000000000 +0200 @@ -16,7 +16,7 @@ # Name: yast2-storage-ng -Version: 4.0.174 +Version: 4.0.178 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -28,6 +28,8 @@ Requires: yast2-ruby-bindings >= 4.0.6 # function light_probe Requires: libstorage-ng-ruby >= 3.3.254 +# communicate with udisks +Requires: rubygem(ruby-dbus) BuildRequires: update-desktop-files # function light_probe @@ -43,6 +45,8 @@ BuildRequires: yast2-ruby-bindings >= 4.0.6 BuildRequires: rubygem(yast-rake) BuildRequires: rubygem(rspec) +# communicate with udisks +BuildRequires: rubygem(ruby-dbus) PreReq: %fillup_prereq Obsoletes: yast2-storage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/src/lib/y2partitioner/clients/main.rb new/yast2-storage-ng-4.0.178/src/lib/y2partitioner/clients/main.rb --- old/yast2-storage-ng-4.0.174/src/lib/y2partitioner/clients/main.rb 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/src/lib/y2partitioner/clients/main.rb 2018-05-09 12:05:41.000000000 +0200 @@ -24,6 +24,7 @@ require "yast2/popup" require "cwm/tree_pager" require "y2partitioner/dialogs/main" +require "y2storage/inhibitors" require "y2storage" module Y2Partitioner @@ -44,9 +45,17 @@ # # @param allow_commit [Boolean] whether the changes can be stored on disk def run(allow_commit: true) - return nil if !run_partitioner? || partitioner_dialog.run != :next + return nil if !run_partitioner? - allow_commit ? commit : forbidden_commit_warning + begin + inhibitors = Y2Storage::Inhibitors.new + inhibitors.inhibit + + return nil if partitioner_dialog.run != :next + allow_commit ? commit : forbidden_commit_warning + ensure + inhibitors.uninhibit + end end private diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/src/lib/y2storage/clients/inst_disk_proposal.rb new/yast2-storage-ng-4.0.178/src/lib/y2storage/clients/inst_disk_proposal.rb --- old/yast2-storage-ng-4.0.174/src/lib/y2storage/clients/inst_disk_proposal.rb 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/src/lib/y2storage/clients/inst_disk_proposal.rb 2018-05-09 12:05:41.000000000 +0200 @@ -25,6 +25,7 @@ require "yast/i18n" require "yast2/popup" require "y2storage" +require "y2storage/dump_manager" require "y2storage/dialogs/proposal" require "y2storage/dialogs/guided_setup" require "y2partitioner/dialogs/main" @@ -126,6 +127,7 @@ when :next @proposal = nil @devicegraph = devicegraph + DumpManager.dump(devicegraph, "partitioner") when :back # Try to create a proposal when the system was reprobed (bsc#1088960) create_initial_proposal if reprobed? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/src/lib/y2storage/dialogs/proposal.rb new/yast2-storage-ng-4.0.178/src/lib/y2storage/dialogs/proposal.rb --- old/yast2-storage-ng-4.0.174/src/lib/y2storage/dialogs/proposal.rb 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/src/lib/y2storage/dialogs/proposal.rb 2018-05-09 12:05:41.000000000 +0200 @@ -54,7 +54,6 @@ actiongraph = @devicegraph ? @devicegraph.actiongraph : nil @actions_presenter = ActionsPresenter.new(actiongraph) - DumpManager.dump(devicegraph, "proposal") DumpManager.dump(@actions_presenter) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/src/lib/y2storage/dump_manager.rb new/yast2-storage-ng-4.0.178/src/lib/y2storage/dump_manager.rb --- old/yast2-storage-ng-4.0.174/src/lib/y2storage/dump_manager.rb 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/src/lib/y2storage/dump_manager.rb 2018-05-09 12:05:41.000000000 +0200 @@ -130,7 +130,7 @@ file_base_name ||= devicegraph_dump_name(devicegraph) dump_internal(devicegraph, file_base_name) do |file_base_path| devicegraph.save(file_base_path + ".xml") - YamlWriter.write(devicegraph, file_base_path + ".yml") + YamlWriter.write(devicegraph, file_base_path + ".yml", record_passwords: false) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/src/lib/y2storage/inhibitors/mdadm_auto_assembly.rb new/yast2-storage-ng-4.0.178/src/lib/y2storage/inhibitors/mdadm_auto_assembly.rb --- old/yast2-storage-ng-4.0.174/src/lib/y2storage/inhibitors/mdadm_auto_assembly.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-storage-ng-4.0.178/src/lib/y2storage/inhibitors/mdadm_auto_assembly.rb 2018-05-09 12:05:41.000000000 +0200 @@ -0,0 +1,49 @@ +# encoding: utf-8 + +# Copyright (c) 2018 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 "yast2/execute" + +module Y2Storage + # class to inhibit mdadm from doing auto assembly + class MdadmAutoAssembly + include Yast::Logger + + def inhibit + log.info "set udev ANACONDA property" + + begin + Yast::Execute.locally!("/sbin/udevadm", "control", "--property=ANACONDA=yes") + rescue Cheetah::ExecutionFailed => e + log.error "disabling mdadm auto assembly failed #{e.message}" + end + end + + def uninhibit + log.info "unset udev ANACONDA property" + + begin + Yast::Execute.locally!("/sbin/udevadm", "control", "--property=ANACONDA=") + rescue Cheetah::ExecutionFailed => e + log.error "enabling mdadm auto assembly failed #{e.message}" + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/src/lib/y2storage/inhibitors/udisks.rb new/yast2-storage-ng-4.0.178/src/lib/y2storage/inhibitors/udisks.rb --- old/yast2-storage-ng-4.0.174/src/lib/y2storage/inhibitors/udisks.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-storage-ng-4.0.178/src/lib/y2storage/inhibitors/udisks.rb 2018-05-09 12:05:41.000000000 +0200 @@ -0,0 +1,61 @@ +# encoding: utf-8 + +# Copyright (c) 2018 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 Y2Storage + # class to inhibit udisks from doing mounts + class Udisks + include Yast::Logger + + @dbus_cookie = nil + + def inhibit + log.info "inhibit udisks" + begin + @dbus_cookie = dbus_object.Inhibit().first + rescue Errno::ENOENT, DBus::Error => e + log.error "inhibit udisks failed #{e.message}" + end + end + + def uninhibit + return if !@dbus_cookie + log.info "uninhibit udisks" + begin + dbus_object.Uninhibit(@dbus_cookie) + @dbus_cookie = nil + rescue Errno::ENOENT, DBus::Error => e + log.error "uninhibit udisks failed #{e.message}" + end + end + + private + + def dbus_object + system_bus = DBus::SystemBus.instance + service = system_bus.service("org.freedesktop.UDisks") + dbus_object = service.object("/org/freedesktop/UDisks") + dbus_object.default_iface = "org.freedesktop.UDisks" + return dbus_object + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/src/lib/y2storage/inhibitors.rb new/yast2-storage-ng-4.0.178/src/lib/y2storage/inhibitors.rb --- old/yast2-storage-ng-4.0.174/src/lib/y2storage/inhibitors.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-storage-ng-4.0.178/src/lib/y2storage/inhibitors.rb 2018-05-09 12:05:41.000000000 +0200 @@ -0,0 +1,53 @@ +# encoding: utf-8 + +# Copyright (c) 2018 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/inhibitors/mdadm_auto_assembly" +require "y2storage/inhibitors/udisks" + +module Y2Storage + # class to inhibit various storage subsystem to automatically do things, + # e.g. mount file systems or assemble RAIDs, that interfere with the + # operation of YaST + class Inhibitors + include Yast::Logger + + def inhibit + log.info "inhibit" + + @mdadm_auto_assembly.inhibit + @udisks.inhibit + end + + def uninhibit + log.info "uninhibit" + + @udisks.uninhibit + @mdadm_auto_assembly.uninhibit + end + + private + + def initialize + @mdadm_auto_assembly = Y2Storage::MdadmAutoAssembly.new + @udisks = Y2Storage::Udisks.new + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/src/lib/y2storage/proposal/autoinst_devices_planner.rb new/yast2-storage-ng-4.0.178/src/lib/y2storage/proposal/autoinst_devices_planner.rb --- old/yast2-storage-ng-4.0.174/src/lib/y2storage/proposal/autoinst_devices_planner.rb 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/src/lib/y2storage/proposal/autoinst_devices_planner.rb 2018-05-09 12:05:41.000000000 +0200 @@ -262,6 +262,7 @@ # @param mount [String] Mount point # @return [Hash] def subvolume_attrs_for(mount) + return {} if mount.nil? spec = VolumeSpecification.for(mount) return {} if spec.nil? { subvolumes_prefix: spec.btrfs_default_subvolume, subvolumes: spec.subvolumes } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/src/lib/y2storage/proposal/autoinst_size_parser.rb new/yast2-storage-ng-4.0.178/src/lib/y2storage/proposal/autoinst_size_parser.rb --- old/yast2-storage-ng-4.0.174/src/lib/y2storage/proposal/autoinst_size_parser.rb 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/src/lib/y2storage/proposal/autoinst_size_parser.rb 2018-05-09 12:05:41.000000000 +0200 @@ -50,7 +50,8 @@ # @param mount_point [String] Mount point # @param min [DiskSize] Minimal size # @param max [DiskSize] Maximal size - # @return [AutoinstSize] Object containing information about size + # @return [AutoinstSize,nil] Object containing information about size; nil if size + # specification is "auto" and no predefined values were found. # # @see AutoinstSize def parse(size_spec, mount_point, min, max) @@ -111,6 +112,7 @@ # @return [nil,Array<DiskSize>] def auto_sizes_for(mount_point) + return nil if mount_point.nil? spec = VolumeSpecification.for(mount_point, proposal_settings: proposal_settings) return nil if spec.nil? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/src/lib/y2storage/yaml_writer.rb new/yast2-storage-ng-4.0.178/src/lib/y2storage/yaml_writer.rb --- old/yast2-storage-ng-4.0.174/src/lib/y2storage/yaml_writer.rb 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/src/lib/y2storage/yaml_writer.rb 2018-05-09 12:05:41.000000000 +0200 @@ -32,6 +32,13 @@ class YamlWriter include Yast::Logger + # @return [Boolean] whether to record passwords (default: true) + attr_accessor :record_passwords + + def initialize + @record_passwords = true + end + class << self # # Write all devices from the specified devicegraph to a YAML file. @@ -43,9 +50,11 @@ # # @param devicegraph [Devicegraph] # @param yaml_file [String | IO] + # @param record_passwords [Boolean] enable recording passwords # - def write(devicegraph, yaml_file) + def write(devicegraph, yaml_file, record_passwords: true) writer = YamlWriter.new + writer.record_passwords = record_passwords writer.write(devicegraph, yaml_file) end end @@ -78,6 +87,7 @@ yaml = [] top_level_devices(devicegraph).each { |device| yaml << yaml_disk_device(device) } devicegraph.lvm_vgs.each { |lvm_vg| yaml << yaml_lvm_vg(lvm_vg) } + unsupported_devices(devicegraph).each { |device| yaml << yaml_unsupported_device(device) } yaml end @@ -392,7 +402,9 @@ } content["name"] = encryption.name - content["password"] = encryption.password unless encryption.password.empty? + if !encryption.password.empty? + content["password"] = @record_passwords ? encryption.password : "***" + end { "encryption" => content } end @@ -429,5 +441,56 @@ content["nocow"] = "true" if subvol.nocow? { "subvolume" => content } end + + # Return YAML for one unsupported device. + # + # @param device [Device] + # @return [Hash] + def yaml_unsupported_device(device) + content = {} + content["type"] = device.class.to_s + content["name"] = device.name if device.respond_to?(:name) + content["support"] = "unsupported in YAML - check XML" + + { "unsupported_device" => content } + end + + # Return all unsupported devices in a devicegraph. Right now this is + # limited to block devices and non-block-filesystem filesystems like NFS. + # + # @param devicegraph [Devicegraph] + # @return [Array<Device>] + def unsupported_devices(devicegraph) + unsupported_blk_devices(devicegraph) + non_blk_filesystem_filesystems(devicegraph) + end + + # Return all unsupported block devices in a devicegraph. + # + # @param devicegraph [Devicegraph] + # @return [Array<Device>] + def unsupported_blk_devices(devicegraph) + BlkDevice.all(devicegraph).reject { |d| supported_blk_device?(d) } + end + + # Return all unsupported filesystems in a devicegraph. + # + # @param devicegraph [Devicegraph] + # @return [Array<Device>] + def non_blk_filesystem_filesystems(devicegraph) + devicegraph.filesystems.reject { |fs| fs.is?(:blk_filesystem) } + end + + # Check if a block device is supported by the YAML writer. + # + # @param blk_device [BlkDevice] + # @return [Boolean] + def supported_blk_device?(blk_device) + # See class hierarchy in libstorage-ng BlkDevice autodocs + # + # NOTICE: We can't simply only handle devicegraph toplevel objects since + # some of the unsupported ones (e.g. RAIDs) don't have a bracketing + # toplevel object, unlike LVM with VGs. + blk_device.is?(:disk, :dasd, :encryption, :lvm_lv, :partition) + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/test/y2storage/proposal/autoinst_devices_planner_test.rb new/yast2-storage-ng-4.0.178/test/y2storage/proposal/autoinst_devices_planner_test.rb --- old/yast2-storage-ng-4.0.174/test/y2storage/proposal/autoinst_devices_planner_test.rb 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/test/y2storage/proposal/autoinst_devices_planner_test.rb 2018-05-09 12:05:41.000000000 +0200 @@ -422,15 +422,16 @@ end end - context "using Btrfs for root" do + context "using Btrfs" do let(:partitioning_array) do [{ "device" => "/dev/sda", "use" => "all", - "enable_snapshots" => snapshots, "partitions" => [root_spec, home_spec] + "enable_snapshots" => snapshots, "partitions" => partitions }] end let(:home_spec) { { "mount" => "/home", "filesystem" => "btrfs" } } let(:root_spec) { { "mount" => "/", "filesystem" => "btrfs", "subvolumes" => subvolumes } } + let(:partitions) { [root_spec, home_spec] } let(:snapshots) { false } let(:devices) { planner.planned_devices(drives_map) } @@ -599,6 +600,16 @@ expect(root.subvolumes).to eq([]) end end + + context "when no mount point is defined" do + let(:partitions) { [root_spec, not_mounted_spec] } + let(:not_mounted_spec) { { "mount" => nil, "filesystem" => "btrfs" } } + let(:not_mounted) { devices.find { |d| d.mount_point.nil? } } + + it "does not plan any subvolume" do + expect(not_mounted.subvolumes).to eq([]) + end + end end context "using LVM" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/test/y2storage/proposal/autoinst_size_parser_test.rb new/yast2-storage-ng-4.0.178/test/y2storage/proposal/autoinst_size_parser_test.rb --- old/yast2-storage-ng-4.0.174/test/y2storage/proposal/autoinst_size_parser_test.rb 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/test/y2storage/proposal/autoinst_size_parser_test.rb 2018-05-09 12:05:41.000000000 +0200 @@ -100,10 +100,16 @@ context "and there are no volumes defined in the control file" do let(:subvolumes) { [] } - it "sets min and max values to nil" do + it "returns nil" do expect(parser.parse("auto", "/srv", MIN, MAX)).to be_nil end end end + + context "when size is nil" do + it "returns nil" do + expect(parser.parse("auto", nil, MIN, MAX)).to be_nil + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.174/test/y2storage/yaml_writer_test.rb new/yast2-storage-ng-4.0.178/test/y2storage/yaml_writer_test.rb --- old/yast2-storage-ng-4.0.174/test/y2storage/yaml_writer_test.rb 2018-05-04 17:28:15.000000000 +0200 +++ new/yast2-storage-ng-4.0.178/test/y2storage/yaml_writer_test.rb 2018-05-09 12:05:41.000000000 +0200 @@ -473,5 +473,83 @@ expect(plain_content(io.string)).to eq(plain_content(expected_result)) end end + + context "when the devicegraph contains objects not yet supported in YAML" do + before do + fake_scenario(scenario) + fs = Y2Storage::Filesystems::Nfs.create(fake_devicegraph, "server", "/path") + fs.create_mount_point("/nfs_mount") + end + let(:scenario) { "empty-dm_raids.xml" } + + let(:expected_result) do + # Without the irrelevant leading 44 lines + %(- unsupported_device: + type: Y2Storage::DmRaid + name: "/dev/mapper/isw_ddgdcbibhd_test1" + support: unsupported in YAML - check XML + - unsupported_device: + type: Y2Storage::DmRaid + name: "/dev/mapper/isw_ddgdcbibhd_test2" + support: unsupported in YAML - check XML + - unsupported_device: + type: Y2Storage::Filesystems::Nfs + name: server:/path + support: unsupported in YAML - check XML) + end + + # Select the relevant part of the YAML for this test: + # Everything from the first line with "-unsupported_device:" on. + # + # @param yaml [String] + # @return [String] + def relevant_part(yaml) + lines = yaml.split("\n") + start_line = lines.index("- unsupported_device:") + return "" if start_line.nil? + lines.shift(start_line) + lines.join("\n") + end + + it "generates the expected yaml content" do + described_class.write(fake_devicegraph, io) + expect(plain_content(relevant_part(io.string))).to eq(plain_content(expected_result)) + end + end + + context "when recording passords is disabled" do + before do + disk = Y2Storage::Disk.create(staging, "/dev/sda") + disk.size = 256 * Storage.GiB + + encryption = disk.create_encryption("cr_data") + encryption.password = "s3cr3t" + + fs = encryption.create_filesystem(Y2Storage::Filesystems::Type::XFS) + fs.create_mount_point("/data") + end + + let(:expected_result) do + %(--- + - disk: + name: "/dev/sda" + size: 256 GiB + block_size: 0.5 KiB + io_size: 0 B + min_grain: 1 MiB + align_ofs: 0 B + file_system: xfs + mount_point: "/data" + encryption: + type: luks + name: "/dev/mapper/cr_data" + password: "***") + end + + it "generates the expected yaml content" do + described_class.write(staging, io, record_passwords: false) + expect(plain_content(io.string)).to eq(plain_content(expected_result)) + end + end end end