Class: UpgradeFormatTask
- Inherits:
-
Object
- Object
- UpgradeFormatTask
- Defined in:
- lib/upgrade_format_task.rb
Overview
Copyright © 2013-2014 SUSE LLC
This program is free software; you can redistribute it and/or modify it under the terms of version 3 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 about this file by physical or electronic mail, you may find current contact information at www.suse.com
Instance Method Summary collapse
Instance Method Details
#upgrade(store, name, options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/upgrade_format_task.rb', line 19 def upgrade(store, name, = {}) if ![:all] && !store.list.include?(name) raise Machinery::Errors::SystemDescriptionNotFound.new( "System description \"#{name}\" does not exist." ) end if [:all] descriptions = store.list else descriptions = [name] end migrations_done = 0 descriptions.each do |description| begin Machinery.logger.info "Upgrading description \"#{description}\"" migrated = Migration.migrate_description(store, description) migrations_done += 1 if migrated rescue StandardError => e msg = "Upgrading description \"#{description}\" failed: #{e.to_s}" Machinery.logger.error msg Machinery::Ui.error msg end end if [:all] if migrations_done > 0 Machinery::Ui.puts "Upgraded #{migrations_done} system descriptions successfully." else Machinery::Ui.puts "No system descriptions were upgraded." end else Machinery::Ui.puts "System description \"#{name}\" successfully upgraded." if migrations_done > 1 end end |