Bug 963230

Summary: rhn-satellite-activate does not modify "disconnected" flag in /etc/rhn/rhn.conf.
Product: [Community] Spacewalk Reporter: Dimitar Yordanov <dyordano>
Component: ServerAssignee: Michael Mráka <mmraka>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.9CC: tkasparek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-backend-1.10.32-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-02 13:10:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 991452    

Description Dimitar Yordanov 2013-05-15 12:51:17 UTC
Description of problem:
 When Spacewalk is installed as disconnected "disconnected" flag is set to 1 in /etc/rhn/rhn.conf.
 In case Spacewalk is afterwards activated against rhn.redhat.com with the help of rhn-satellite-activate  "disconnected=1"  will not be modified in /etc/rhn/rhn.conf and satelite-sync will fail to sync a channel.

Version-Release number of selected component (if applicable):
spacewalk-backend-tools-1.7.38-2

How reproducible:
100%

Steps to Reproduce:
1. Install Spacewalk as disconnected 
     spacewalk-setup --answer-file=/tmp/answers.txt --disconnected

2. Activate Spacewalk to rhn.redhat.com
    rhn-satellite-activate --ignore-version-mismatch

3. Try to sync a channel from rhn.redhat.com
  18:54:58 Red Hat Network Satellite - live synchronization
  18:54:58 ERROR: Can't use live synchronization in disconnected mode.
  # satellite-sync -c rhel-x86_64-server-6 --no-packages  --no-errata --no-kickstarts


Additional info:
[spacewalk{master}]$ git show 1bf057e0
commit 1bf057e0c697c66c604287b9eba9a2b0e33969db
Author: Michael Mraka <michael.mraka>
Date:   Fri May 10 13:43:04 2013 +0200

    888378 - print nice error message in disconnected mode

diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index d075a3d..11fd76b 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -434,9 +434,13 @@ class Syncer:
                 sync_parent = CFG.ISS_PARENT
                 self.systemid = 'N/A'   # systemid is not used in ISS auth process
                 is_iss = 1
-            else:
+            elif not CFG.DISCONNECTED:
                 sync_parent = CFG.RHN_PARENT
                 is_iss = 0
+            else:
+                log(1, _('Red Hat Network Satellite - live synchronization'))
+                log(-1, _("ERROR: Can't use live synchronization in disconnected mode."), stream=sys.stderr)
+                sys.exit(1)
 
             url = self.xmlDataServer.schemeAndUrl(sync_parent)
             log(1, [_('Red Hat Network Satellite - live synchronization'),

Comment 1 Dimitar Yordanov 2013-05-16 11:28:42 UTC
The Step 2 in the reproducer will fail as well.
This is a regression against Satellite 5.6 Beta.

# rhn-satellite-activate --rhn-cert=redhat-internal-sputnik.cert-5.5.cert 
RHN_PARENT: satellite.rhn.redhat.com
Population of the Channel Family permissions failed.
Return value: 1
Standard-out: 06:26:27 Red Hat Network Satellite - live synchronization

Standard-error: 06:26:27 ERROR: Can't use live synchronization in disconnected mode.

ERROR: Population of the Channel Family permissions failed.

Comment 2 Michael Mráka 2013-05-17 12:58:45 UTC
Warn user when activating disconnected satellite remotely:

Fixed in spacewalk master by
commit d0d7723c27fb03422b4c833af641d29ac7f02eb7
    963230 - remote activation in disconnected mode is not valid

Comment 3 Tomáš Kašpárek 2013-08-02 13:10:36 UTC
Fix for this bug is present in Spacewalk 2.0, closing this bug as CURRENTRELEASE.