Skip to content

Commit

Permalink
Undone rollback feature for Connect
Browse files Browse the repository at this point in the history
  • Loading branch information
kalabiyau committed Oct 23, 2015
1 parent 81934d2 commit c3864d8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
coverage/
.git
.yardoc/
23 changes: 20 additions & 3 deletions features/rollback.feature
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
@slow_process
Feature: Rollback registration state to system products

Scenario: Register base system
Background:
Given I have a system with activated base product

Scenario: Migration targets
When Prepare SUSEConnect client with a valid regcode
Then I should receive 'SLES12-SP1' as a migration target

Scenario: Rollback can be called on activated system without issues
Scenario: Rollback can be called on activated system without an issue
When I call the migration rollback method

Then a file named "/etc/zypp/credentials.d/SCCcredentials" should exist
Expand All @@ -20,6 +19,24 @@ Feature: Rollback registration state to system products
And zypper should contain a service for base product
And zypper should contain the repositories for base product

Scenario: Rollback can be called from console with the same outcome as called from library
Given I have a system with activated base product
And I run `SUSEConnect --rollback`

Then the exit status should be 67
And the output should contain:
"""
> Beginning rollback. This can take some time...
> Rollback completed.1
"""
And a file named "/etc/zypp/credentials.d/SCCcredentials" should exist
And the file "/etc/zypp/credentials.d/SCCcredentials" should contain "SCC_"

And a file named "/etc/zypp/credentials.d/SUSE_Linux_Enterprise_Server_12_x86_64" should exist
And the file "/etc/zypp/credentials.d/SUSE_Linux_Enterprise_Server_12_x86_64" should contain "SCC_"

And zypper should contain a service for base product
And zypper should contain the repositories for base product

Scenario: Remove all registration leftovers
Then I deregister the system
8 changes: 8 additions & 0 deletions lib/suse/connect/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ def extract_options # rubocop:disable MethodLength
@options[:cleanup] = true
end

@opts.on('--rollback', 'revert state of the system if case of failed migration') do |_opt|
log.info('> Beginning rollback. This can take some time...')
SUSE::Connect::Migration.rollback
exit 0

puts '> Rollback completed.'
end

@opts.separator ''
@opts.separator 'Common options:'

Expand Down

0 comments on commit c3864d8

Please sign in to comment.