Bug 1434913 - cdn-sync could provide information that the satellite is not activated
Summary: cdn-sync could provide information that the satellite is not activated
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Satellite Synchronization
Version: 580
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
Assignee: Eric Herget
QA Contact: Pavel Studeník
URL:
Whiteboard:
Depends On:
Blocks: sat580-low
TreeView+ depends on / blocked
 
Reported: 2017-03-22 15:06 UTC by Kenny Tordeurs
Modified: 2017-06-21 12:07 UTC (History)
4 users (show)

Fixed In Version: spacewalk-backend-2.5.3-133-sat
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-21 12:07:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Kenny Tordeurs 2017-03-22 15:06:01 UTC
Description of problem:
cdn-sync does not tell you when the Satellite is not activated while cdn-sync -l does

Version-Release number of selected component (if applicable):
Satellite 5.8 Beta

How reproducible:
100%

Steps to Reproduce:
1. Try cdn-sync without activation
2.
3.

Actual results:
[root@ktordeur-sat57 satellite]# cdn-sync 
ERROR: these channels either do not exist or are not available:
  rhel-x86_64-server-6
  rhel-x86_64-server-7
  rhel-x86_64-as-4
  rhel-x86_64-as-4-cluster
  redhat-rhn-proxy-5.6-server-x86_64-6
  redhat-rhn-satellite-5.6-server-x86_64-6
  rhel-x86_64-server-6-rhscl-1
  rhel-x86_64-as-4-els
  rhel-x86_64-server-supplementary-6
  rhel-x86_64-server-7-rhscl-1
  rhn-tools-rhel-x86_64-server-6
  rhn-tools-rhel-x86_64-server-7
  rhel-x86_64-server-6-thirdparty-oracle-java
  rhel-x86_64-server-7-thirdparty-oracle-java
  rhel-x86_64-server-7.2.eus
  rhel-x86_64-server-extras-6
(to see a list of channel labels: /usr/bin/cdn-sync --list-channels)


[root@ktordeur-sat57 satellite]# cdn-sync -l
16:03:27 No available channels were found. Is your Red Hat Satellite activated for CDN?


Expected results:
16:03:27 No available channels were found. Is your Red Hat Satellite activated for CDN?

Additional info:

Comment 2 Jan Dobes 2017-03-22 21:32:46 UTC
I think the behaviour is now different after bz1427238 fixes but we should make sure it's correct.

Comment 3 Eric Herget 2017-04-04 20:25:32 UTC
I installed a fresh spacewalk system from nightly repos, did not activate it, and now the behavior is different than before (as mentioned in comment #2).  The cdn-sync commands mentioned in the description now have the following output:

# cdn-sync -l
16:18:49 p = previously imported/synced channel
16:18:49 . = channel not yet imported/synced
16:18:49 ? = package count not available (try to run cdn-sync --count-packages)
16:18:49 Entitled base channels:
16:18:49       NONE
16:18:49 Entitled child channels:
16:18:49       NONE
16:18:49 Custom channels syncing from CDN:
16:18:49       NONE

# cdn-sync
16:19:01 Total time: 0:00:00

With this new behavior, can this BZ be closed?  Or should there be an indication that the system is not activated yet?

Comment 4 Eric Herget 2017-04-04 20:42:26 UTC
Follow up to comment #3... I put spacewalk in disconnected mode and get the output below.  I think I need to deactivate my spacewalk server and try this again.

# cdn-sync
ERROR: the Satellite server is installed in disconnected mode, cannot continue syncing from CDN

# cdn-sync -l
ERROR: the Satellite server is installed in disconnected mode, cannot continue syncing from CDN

Comment 5 Kenny Tordeurs 2017-04-05 07:28:47 UTC
It would be nice to have an indication that the satellite is not yet activated.

Comment 6 Eric Herget 2017-04-10 18:28:35 UTC
I have re-tested this on a Satellite system (not spacewalk) and here is the behavior after cdn-sync'ing a channel, and then running `rhn-satellite-activate --cdn-deactivate`:

# cdn-sync
14:20:45 ERROR: Channel 'rhel-x86_64-client-6' repositories are not available.
14:20:45 ERROR: these channels either do not exist or are not available:
  rhel-x86_64-client-6
14:20:45 Total time: 0:00:00
ERROR: these channels either do not exist or are not available:
  rhel-x86_64-client-6

# cdn-sync -l
13:58:58 p = previously imported/synced channel
13:58:58 . = channel not yet imported/synced
13:58:58 ? = package count not available (try to run cdn-sync --count-packages)
13:58:58 Entitled base channels:
13:58:58       NONE
13:58:58 Entitled child channels:
13:58:58       NONE
13:58:58 Custom channels syncing from CDN:
13:58:58       NONE

Comment 7 Jan Dobes 2017-04-11 14:31:38 UTC
Yes, it seems it was my intentional change when I was adding support for syncing into custom channels, I don't remember why though. However, if I run it in verbose, I see following:

# cdn-sync -lv
...
16:17:24 WARNING: No available channels from channel mappings were found. Is cdn-sync-mappings package installed and your Spacewalk activated?
16:17:24 p = previously imported/synced channel
16:17:24 . = channel not yet imported/synced
16:17:24 ? = package count not available (try to run cdn-sync --count-packages)
16:17:24 Entitled base channels:
16:17:24       NONE
16:17:24 Entitled child channels:
16:17:24       NONE
16:17:24 Custom channels syncing from CDN:
16:17:24       NONE

Maybe we can change it back to print just a error message if it's not activated regardless if mappings package is installed or not (because it works on Spacewalk like that). Or we can keep the output like this, only display the WARNING on default verbosity setting.

And we should improve the "cdn-sync" output, now it looks like below. It's same as in comment #0 but it's printed twice because of one of other bugzilla which prints not available channels on start and on end, which is the behavior I don't like when there isn't anything in between.
# cdn-sync
16:23:14 ERROR: Channel 'rhel-x86_64-server-5' repositories are not available.
16:23:14 ERROR: Channel 'rhel-x86_64-server-6' repositories are not available.
16:23:14 ERROR: Channel 'rhel-x86_64-server-7' repositories are not available.
16:23:14 ERROR: Channel 'rhn-tools-rhel-x86_64-server-5' repositories are not available.
16:23:14 ERROR: Channel 'rhn-tools-rhel-x86_64-server-7' repositories are not available.
16:23:14 ERROR: Channel 'rhel-s390x-server-5' repositories are not available.
16:23:14 ERROR: Channel 'rhn-tools-rhel-x86_64-server-6' repositories are not available.
16:23:14 ERROR: Channel 'redhat-rhn-proxy-5.7-server-x86_64-6' repositories are not available.
16:23:14 ERROR: Channel 'rhn-tools-rhel-s390x-server-5' repositories are not available.
16:23:14 ERROR: Channel 'rhel-x86_64-workstation-7' repositories are not available.
16:23:14 ERROR: Channel 'rhel-ppc64le-server-sap-7' repositories are not available.
16:23:14 ERROR: Channel 'rhn-tools-rhel-s390x-server-6' repositories are not available.
16:23:14 ERROR: Channel 'rhel-x86_64-ost-10-tools-workstation-debuginfo' repositories are not available.
16:23:14 ERROR: Channel 'rhel-x86_64-server-extras-7' repositories are not available.
16:23:14 ERROR: Channel 'rhel-ppc64le-server-7' repositories are not available.
16:23:14 ERROR: Channel 'rhel-s390x-server-6' repositories are not available.
16:23:14 ERROR: these channels either do not exist or are not available:
  rhel-x86_64-server-5
  rhel-x86_64-server-6
  rhel-x86_64-server-7
  rhn-tools-rhel-x86_64-server-5
  rhn-tools-rhel-x86_64-server-7
  rhel-s390x-server-5
  rhn-tools-rhel-x86_64-server-6
  redhat-rhn-proxy-5.7-server-x86_64-6
  rhn-tools-rhel-s390x-server-5
  rhel-x86_64-workstation-7
  rhel-ppc64le-server-sap-7
  rhn-tools-rhel-s390x-server-6
  rhel-x86_64-ost-10-tools-workstation-debuginfo
  rhel-x86_64-server-extras-7
  rhel-ppc64le-server-7
  rhel-s390x-server-6
16:23:14 Total time: 0:00:00
ERROR: these channels either do not exist or are not available:
  rhel-x86_64-server-5
  rhel-x86_64-server-6
  rhel-x86_64-server-7
  rhn-tools-rhel-x86_64-server-5
  rhn-tools-rhel-x86_64-server-7
  rhel-s390x-server-5
  rhn-tools-rhel-x86_64-server-6
  redhat-rhn-proxy-5.7-server-x86_64-6
  rhn-tools-rhel-s390x-server-5
  rhel-x86_64-workstation-7
  rhel-ppc64le-server-sap-7
  rhn-tools-rhel-s390x-server-6
  rhel-x86_64-ost-10-tools-workstation-debuginfo
  rhel-x86_64-server-extras-7
  rhel-ppc64le-server-7
  rhel-s390x-server-6

Comment 8 Eric Herget 2017-04-11 14:39:15 UTC
I will update the cdn-sync command (with no args) output.  This "extra" messaging will be displayed when any previously sync'd channels are not available to be sync'd, as well as there are no available channels to be sync'd.  In that specific case, the added messaging will be:

Perhaps your Red Hat Satellite is not activated for CDN.
(to see details about currently used SSL certificates for accessing CDN:
 /usr/bin/cdn-sync --cdn-certs)

Comment 9 Eric Herget 2017-04-11 14:40:20 UTC
I will also working on getting rid of the duplicate output.  It's coming from the logging in the CdnSync object.

Comment 10 Eric Herget 2017-04-11 21:00:50 UTC
spacewalk.github:
e3cf201a40db3ed0eb8c43557fd51d386dc72a74

spacewalk-backend-2.7.74-1

Comment 11 Eric Herget 2017-04-17 21:43:52 UTC
additional commit for spacewalk.  Below is all commits.

spacewalk.github:
e3cf201a40db3ed0eb8c43557fd51d386dc72a74
19f36074dc174f7370db9e41d485eecb4cad1459

spacewalk-backend-2.7.75-1

Comment 12 Eric Herget 2017-04-18 12:50:03 UTC
The second commit above changes slightly the messaging to more closely match existing messaging to the user.  It now says:

WARNING: Is your Red Hat Satellite activated for CDN?
(to see details about currently used SSL certificates for accessing CDN:
 /usr/bin/cdn-sync --cdn-certs)

Comment 15 Eric Herget 2017-04-27 15:17:14 UTC
spacewalk.github:
16cca402518a83048c8d1caae4197e1b7e943ac7

spacewalk-backend-2.7.83-1

NOTE: this commit adds a fix for traceback caused by attempt to release lockfile twice as a result of calling system_exit() after lock is first released -
 sys.exit() raises SystemExit exception.

Comment 16 Pavel Studeník 2017-05-17 11:19:25 UTC
I deactivated Satellite by command:

>> rhn-satellite-activate --deactivate

1)
>> cdn-sync -l
07:04:21 p = previously imported/synced channel
07:04:21 . = channel not yet imported/synced
07:04:21 ? = package count not available (try to run cdn-sync --count-packages)
07:04:21 Entitled base channels:
07:04:21       NONE
07:04:21 Entitled child channels:
07:04:21       NONE
07:04:21 Custom channels syncing from CDN:
07:04:21       NONE
>> echo $?
0

Is it good that exit code is 0? I think no.

2)
>> cdn-sync -rv
07:05:20 ERROR: No SSL certificates were found for repository '/content/dist/rhel/server/5/5Server/x86_64/os'
07:05:20 ERROR: Channel 'rhel-x86_64-server-5' repositories are not available.
07:05:20 ERROR: No SSL certificates were found for repository '/content/dist/rhel/server/6/6Server/x86_64/os'
07:05:20 ERROR: Channel 'rhel-x86_64-server-6' repositories are not available.
07:05:20 ERROR: No SSL certificates were found for repository '/content/dist/rhel/server/7/7Server/x86_64/os'
07:05:20 ERROR: Channel 'rhel-x86_64-server-7' repositories are not available.
07:05:20 Total time: 0:00:00
ERROR: these channels either do not exist or are not available:
  rhel-x86_64-server-5
  rhel-x86_64-server-6
  rhel-x86_64-server-7
WARNING: Is your Red Hat Satellite activated for CDN?
(to see details about currently used SSL certificates for accessing CDN: /usr/bin/cdn-sync --cdn-certs)
>> echo $?
1

I suppose that it is good. But when I try to show cdn-certs:

3) 
>> cdn-sync --cdn-certs
07:06:52 No SSL certificates were found. Is your Red Hat Satellite activated for CDN?
>> echo $?
0

It is not valid state and exit code should be different. 

Same situation is for option count-packages:

>> dn-sync --count-packages
07:17:20 Number of channels: 0
07:17:20 Number of repositories: 0
07:17:20 Total time: 0:00:00
>> echo $?
0

Comment 17 Eric Herget 2017-05-18 20:50:25 UTC
These cases should now result in an appropriate warning message and an exit status of 1.

NOTE: I also fixed a problem in one warning message where the message was not using PRODUCT_NAME.

Comment 18 Eric Herget 2017-05-18 20:51:07 UTC
spacewalk.github:
170a3c3a6fb7ab760302d9676125509904d6c550

fixed in spacewalk-backend-2.7.103-1

Comment 21 Pavel Studeník 2017-05-31 15:14:32 UTC
Verified with spacewalk-backend-cdn-2.5.3-137.el6sat.noarch

>> cdn-sync --count-packages
17:12:15 ERROR: Your Red Hat Satellite is not activated for CDN
(to see details about currently used SSL certificates for accessing CDN: /usr/bin/cdn-sync --cdn-certs)
>> echo $?
1

>> cdn-sync -l
17:11:39 ERROR: Your Red Hat Satellite is not activated for CDN
(to see details about currently used SSL certificates for accessing CDN: /usr/bin/cdn-sync --cdn-certs)


Note You need to log in before you can comment on or make changes to this bug.