Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
portusctl: fixed error on Travis
Browse files Browse the repository at this point in the history
Signed-off-by: Miquel Sabaté Solà <[email protected]>
  • Loading branch information
mssola committed Oct 19, 2016
1 parent 6b4dcbe commit fe5f560
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packaging/suse/portusctl/lib/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def registry_local?
return user_confirm?
end

return registry_safe_install! if $CHILD_STATUS == ZYPPER_NOT_INSTALLED
return registry_safe_install! if installed_error?
false
end

Expand All @@ -71,6 +71,12 @@ def install_registry_rpm!
Runner.safe_exec("zypper", ["-q", "-n", "--no-gpg-checks", "in", REGISTRY_RPM])
end

# Returns true if the last system() call returned a ZYPPER_NOT_INSTALLED
# error.
def installed_error?
$CHILD_STATUS == ZYPPER_NOT_INSTALLED
end

# Returns true if the user wrote either "y", "yes" (including uppercase
# variations) or nothing.
def user_confirm?
Expand Down
5 changes: 4 additions & 1 deletion packaging/suse/portusctl/spec/registry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ def user_confirm?
val = ENV["TEST_CONFIRM"]
val == "y" || val == "yes"
end

def installed_error?
ZYPPER_NOT_INSTALLED == ENV["TEST_EXIT_STATUS"].to_i
end
end

class Runner
def self.safe_exec_test(_cmd, _args = [])
if ENV["TEST_EXIT_STATUS"]
$CHILD_STATUS = ENV["TEST_EXIT_STATUS"].to_i
false
else
true
Expand Down

0 comments on commit fe5f560

Please sign in to comment.