Bug 1446271 - satellite-sync via ISS does not transfer product_name_id value for channel
Summary: satellite-sync via ISS does not transfer product_name_id value for channel
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Satellite Synchronization
Version: 580
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Jan Dobes
QA Contact: Radovan Drazny
URL:
Whiteboard:
Depends On:
Blocks: sat58-errata
TreeView+ depends on / blocked
 
Reported: 2017-04-27 14:37 UTC by Jan Hutař
Modified: 2017-09-06 12:27 UTC (History)
7 users (show)

Fixed In Version: spacewalk-backend-2.5.3-145-sat
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-09-06 12:27:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:2645 0 normal SHIPPED_LIVE Moderate: satellite and spacewalk security and bug fix update 2017-09-06 16:26:43 UTC

Description Jan Hutař 2017-04-27 14:37:50 UTC
Description of problem:
satellite-sync via ISS does not transfer product_name_id value for channel. IMO this can be important when you have some kind of sat_connected -> sat_disconnected setup and you are trying to switch EUS channels.


Version-Release number of selected component (if applicable):
spacewalk-backend-2.5.3-111.el6sat.noarch


How reproducible:
on one setup


Steps to Reproduce:
1. On sat570 sync rhel-x86_64-server-vt-5
2. ISS satellite-sync it to sat580
3. Check product_name_id value for the VT channel


Actual results:
[root@satellite580 ~]# echo -e "select id,label,product_name_id,channel_product_id from rhnChannel;\nselect * from rhnProductName;\nselect * from rhnChannelProduct;" | spacewalk-sql -i
 id  |           label            | product_name_id | channel_product_id 
-----+----------------------------+-----------------+--------------------
 102 | rhn-tools-rhel-4-as-x86_64 |                 |                  2
 101 | rhel-x86_64-as-4           |             101 |                  1
 103 | rhel-x86_64-server-5       |             101 |                  3
 104 | rhel-x86_64-server-vt-5    |                 |                  4
(4 rows)

 id  | label |       name       |            created            |           modified            
-----+-------+------------------+-------------------------------+-------------------------------
 101 | rhel  | Enterprise Linux | 2017-04-25 17:27:27.210786-04 | 2017-04-25 17:27:27.210786-04
(1 row)

 id |  product  | version | beta |            created            |           modified            
----+-----------+---------+------+-------------------------------+-------------------------------
  1 | rhel      | 4       | N    | 2017-04-25 17:27:27.818142-04 | 2017-04-25 17:27:27.818142-04
  2 | rhn-tools | 4       | N    | 2017-04-26 02:48:36.726368-04 | 2017-04-26 02:48:36.726368-04
  3 | rhel      | 5       | N    | 2017-04-27 10:25:00.451481-04 | 2017-04-27 10:25:00.451481-04
  4 | vt        | 5       | N    | 2017-04-27 10:25:00.451481-04 | 2017-04-27 10:25:00.451481-04
(4 rows)


Expected results:
product_name_id value should be synced as well

Comment 1 Jan Hutař 2017-04-27 14:40:54 UTC
First, have almost empty sat580:

[root@satellite580 ~]# echo -e "select id,label,product_name_id,channel_product_id from rhnChannel;\nselect * from rhnProductName;\nselect * from rhnChannelProduct;" | spacewalk-sql -i
 id  |           label            | product_name_id | channel_product_id 
-----+----------------------------+-----------------+--------------------
 102 | rhn-tools-rhel-4-as-x86_64 |                 |                  2
 101 | rhel-x86_64-as-4           |             101 |                  1
(2 rows)

 id  | label |       name       |            created            |           modified            
-----+-------+------------------+-------------------------------+-------------------------------
 101 | rhel  | Enterprise Linux | 2017-04-25 17:27:27.210786-04 | 2017-04-25 17:27:27.210786-04
(1 row)

 id |  product  | version | beta |            created            |           modified            
----+-----------+---------+------+-------------------------------+-------------------------------
  1 | rhel      | 4       | N    | 2017-04-25 17:27:27.818142-04 | 2017-04-25 17:27:27.818142-04
  2 | rhn-tools | 4       | N    | 2017-04-26 02:48:36.726368-04 | 2017-04-26 02:48:36.726368-04
(2 rows)

Now sync via ISS from sat570 (these channels were synced there with --no-* options):

[root@satellite580 ~]# satellite-sync --iss-parent satellite570.example.com -c rhel-x86_64-server-5 -c rhel-x86_64-server-vt-5
10:24:59 Red Hat Satellite - live synchronization
10:24:59    url: https://satellite570.example.com
10:24:59    debug/output level: 1
10:24:59    db:  rhnuser/<password>@rhnschema
10:24:59 
10:24:59 Retrieving / parsing orgs data
10:24:59 orgs data complete
10:24:59 
10:24:59 Retrieving / parsing channel-families data
10:25:00 channel-families data complete
10:25:00 
10:25:00 Retrieving / parsing product names data
10:25:00 product names data complete
10:25:00 
10:25:00 Retrieving / parsing arches data
10:25:00 arches data complete
10:25:00 
10:25:00 Retrieving / parsing additional arches data
10:25:00 additional arches data complete
10:25:00 
10:25:00 Retrieving / parsing channel data
10:25:00    p = previously imported/synced channel
10:25:00    . = channel not yet imported/synced
10:25:00    base-channels:
10:25:00       . rhel-x86_64-server-5                        0       full import from Thu Apr 27 10:21:04 2017
10:25:00    rhel-x86_64-server-5:
10:25:00       . rhel-x86_64-server-vt-5                     0       full import from Thu Apr 27 10:21:04 2017
10:25:00 
10:25:00 Channel data complete
10:25:00 
10:25:00 Retrieving short package metadata (used for indexing)
10:25:00    Retrieving / parsing short package metadata: rhel-x86_64-server-5 (0)
10:25:00    Retrieving / parsing short package metadata: rhel-x86_64-server-vt-5 (0)
10:25:00 Diffing package metadata (what's missing locally?): rhel-x86_64-server-5
10:25:00 Diffing package metadata (what's missing locally?): rhel-x86_64-server-vt-5
10:25:00 
10:25:00 Downloading package metadata
10:25:00    Retrieving / parsing *relevant* package metadata: rhel-x86_64-server-5 (NONE RELEVANT)
10:25:00    Retrieving / parsing *relevant* package metadata: rhel-x86_64-server-vt-5 (NONE RELEVANT)
10:25:00 
10:25:00 Downloading rpm packages
10:25:00    Fetching any missing RPMs: rhel-x86_64-server-5 (NONE MISSING)
10:25:00    Fetching any missing RPMs: rhel-x86_64-server-vt-5 (NONE MISSING)
10:25:00 Processing rpm packages complete
10:25:00 
10:25:00 Importing package metadata
10:25:00    Importing *relevant* package metadata: rhel-x86_64-server-5 (NONE RELEVANT)
10:25:00    Importing *relevant* package metadata: rhel-x86_64-server-vt-5 (NONE RELEVANT)
10:25:00 
10:25:00 Linking packages to channels
10:25:00 
10:25:00 Downloading errata data
10:25:00    Retrieving / parsing errata data: rhel-x86_64-server-5 (NONE RELEVANT)
10:25:00    Retrieving / parsing errata data: rhel-x86_64-server-vt-5 (NONE RELEVANT)
10:25:00 Downloading errata data complete
10:25:00 
10:25:00 Downloading kickstartable trees metadata
10:25:00    Retrieving / parsing kickstart data: rhel-x86_64-server-5 (NONE RELEVANT)
10:25:00    Retrieving / parsing kickstart data: rhel-x86_64-server-vt-5 (NONE RELEVANT)
10:25:00 
10:25:00 Downloading kickstartable trees files
10:25:00    Retrieving / parsing kickstart tree files: rhel-x86_64-server-5 (NONE RELEVANT)
10:25:00    Retrieving / parsing kickstart tree files: rhel-x86_64-server-vt-5 (NONE RELEVANT)
10:25:00 
10:25:00 Importing channel errata
10:25:00    Importing *relevant* errata: rhel-x86_64-server-5 (NONE RELEVANT)
10:25:00    Importing *relevant* errata: rhel-x86_64-server-vt-5 (NONE RELEVANT)
10:25:00    No new kickstartable tree to import
    Import complete:
        Begin time: Thu Apr 27 10:24:59 2017
        End time:   Thu Apr 27 10:25:00 2017
        Elapsed:    0 hours, 0 minutes, 1 seconds
          
Now check tables again. Value for product_name_id is still NULL:

[root@satellite580 ~]# echo -e "select id,label,product_name_id,channel_product_id from rhnChannel;\nselect * from rhnProductName;\nselect * from rhnChannelProduct;" | spacewalk-sql -i
 id  |           label            | product_name_id | channel_product_id 
-----+----------------------------+-----------------+--------------------
 102 | rhn-tools-rhel-4-as-x86_64 |                 |                  2
 101 | rhel-x86_64-as-4           |             101 |                  1
 103 | rhel-x86_64-server-5       |             101 |                  3
 104 | rhel-x86_64-server-vt-5    |                 |                  4
(4 rows)

 id  | label |       name       |            created            |           modified            
-----+-------+------------------+-------------------------------+-------------------------------
 101 | rhel  | Enterprise Linux | 2017-04-25 17:27:27.210786-04 | 2017-04-25 17:27:27.210786-04
(1 row)

 id |  product  | version | beta |            created            |           modified            
----+-----------+---------+------+-------------------------------+-------------------------------
  1 | rhel      | 4       | N    | 2017-04-25 17:27:27.818142-04 | 2017-04-25 17:27:27.818142-04
  2 | rhn-tools | 4       | N    | 2017-04-26 02:48:36.726368-04 | 2017-04-26 02:48:36.726368-04
  3 | rhel      | 5       | N    | 2017-04-27 10:25:00.451481-04 | 2017-04-27 10:25:00.451481-04
  4 | vt        | 5       | N    | 2017-04-27 10:25:00.451481-04 | 2017-04-27 10:25:00.451481-04
(4 rows)

Now try to resync from CDN and ensure product_name_id gets fixed:

[root@satellite580 ~]# cdn-sync -c rhel-x86_64-server-5 -c rhel-x86_64-server-vt-5 --no-rpms --no-packages --no-errata --no-kickstarts
10:25:42 Parameter --no-rpms has no effect.
10:25:43 ======================================
10:25:43 | Channel: rhel-x86_64-server-5
10:25:43 ======================================
10:25:43 Sync of channel started.
10:25:43 Repo URL: https://cdn.redhat.com/content/dist/rhel/server/5/5Server/x86_64/os
10:25:43 Sync of channel completed in 0:00:00.
10:25:43 ======================================
10:25:43 | Channel: rhel-x86_64-server-vt-5
10:25:43 ======================================
10:25:43 Sync of channel started.
10:25:43 Repo URL: https://cdn.redhat.com/content/dist/rhel/server/5/5Server/x86_64/vt/os
10:25:44 Sync of channel completed in 0:00:00.
10:25:44 Total time: 0:00:00
[root@satellite580 ~]# echo -e "select id,label,product_name_id,channel_product_id from rhnChannel;\nselect * from rhnProductName;\nselect * from rhnChannelProduct;" | spacewalk-sql -i
 id  |           label            | product_name_id | channel_product_id 
-----+----------------------------+-----------------+--------------------
 102 | rhn-tools-rhel-4-as-x86_64 |                 |                  2
 101 | rhel-x86_64-as-4           |             101 |                  1
 103 | rhel-x86_64-server-5       |             101 |                  3
 104 | rhel-x86_64-server-vt-5    |             102 |                  4
(4 rows)

 id  | label |       name       |            created            |           modified            
-----+-------+------------------+-------------------------------+-------------------------------
 101 | rhel  | Enterprise Linux | 2017-04-25 17:27:27.210786-04 | 2017-04-25 17:27:27.210786-04
 102 | vt    | Virtualization   | 2017-04-27 10:25:42.708103-04 | 2017-04-27 10:25:42.708103-04
(2 rows)

 id |  product  | version | beta |            created            |           modified            
----+-----------+---------+------+-------------------------------+-------------------------------
  1 | rhel      | 4       | N    | 2017-04-25 17:27:27.818142-04 | 2017-04-25 17:27:27.818142-04
  2 | rhn-tools | 4       | N    | 2017-04-26 02:48:36.726368-04 | 2017-04-26 02:48:36.726368-04
  3 | rhel      | 5       | N    | 2017-04-27 10:25:00.451481-04 | 2017-04-27 10:25:00.451481-04
  4 | vt        | 5       | N    | 2017-04-27 10:25:00.451481-04 | 2017-04-27 10:25:00.451481-04
(4 rows)

Comment 2 Jan Dobes 2017-05-11 09:56:44 UTC
This bug is reproducible using single machine and syncing from dump.

1. sync channel like:
# cdn-sync -c rhel-x86_64-server-7 --no-packages --no-errata --no-kickstarts
2. dump channel into directory:
# rhn-satellite-exporter -c rhel-x86_64-server-7 -d dump/
3. delete channel:
# spacewalk-remove-channel -c rhel-x86_64-server-7
4. IMPORTANT - delete content of rhnProductName table:
delete from rhnproductname;
5. sync from dump:
# satellite-sync -m dump/ -c rhel-x86_64-server-7
6. nothing is inserted into rhnProductName table and nothing is referenced from rhnChannel record, if step 4. is skipped, it works

Comment 5 Jan Dobes 2017-07-28 15:17:25 UTC
fixed in spacewalk.git(master):

8c974284844aeaf40a23f41fc6cca30c6f731e72

this is a server-side fix, satellite-sync code is unchanged, only exporting/ISS code is fixed

product names are now included in disk dump as "dump/product_names/product_names.xml.gz" and are also exported when using ISS

* in disk dumps are included only product names of relevant exported channels
* in ISS are synced all product names from master (I think sync from RHN does the same)

Comment 11 Radovan Drazny 2017-08-16 12:27:58 UTC
Reproduced the problem on spacewalk-backend-2.5.3-144.el6sat using the reproducer from the initial report and from the comment #2. 

After update to spacewalk-backend-2.5.3-148.el6sat:

* importing from a dump created with pre-fix version of spacewalk-backend ended with empty rhnProductName table - expected, as the fix is in exporter code, not in sat-sync code. 

* import from a dump created with the fixed version of spacewalk-backend added correct data to the rhnProductName table

* syncing a channel from a Satellite 5.7 server ended with empty rhnProductName table, which according to comments #5 and #3 is expected, because this is a server side fix, and we will need to backport it to older Sat versions. 

* syncing a channel from a Sat 5.8 server without the fix applied to a Sat 5.8 with the fix applied ended with empty rhnProductName table. Same case as in the previous point - this is server side fix, so fix on the slave side doesn't help.

* syncing a channel from a Sat 5.8 server to a Sat 5.8 server (both fixed) ended with even more than we asked for, which is expected behaviour:

[root@dell-pem805-01 ~]# echo -e "select id,label,product_name_id,channel_product_id from rhnChannel;\nselect * from rhnProductName;\nselect * from rhnChannelProduct;" | spacewalk-sql -i
 id | label | product_name_id | channel_product_id
----+-------+-----------------+--------------------
(0 rows)

 id | label | name | created | modified
----+-------+------+---------+----------
(0 rows)

 id | product | version | beta |            created            |           modified
----+---------+---------+------+-------------------------------+-------------------------------
  1 | rhel    | 7       | N    | 2017-08-14 09:04:10.998676-04 | 2017-08-14 09:04:10.998676-04
(1 row)

[root@dell-pem805-01 ~]# satellite-sync -c rhel-x86_64-server-7 --no-rpms --no-packages --no-errata --no-kickstarts --iss-parent mastersat58.example.com
05:05:16 Red Hat Satellite - live synchronization
05:05:16    url: https://mastersat58.example.com
05:05:16    debug/output level: 1
05:05:16    db:  rhnuser/<password>@rhnschema
05:05:16 
05:05:16 Retrieving / parsing orgs data
05:05:17 orgs data complete
05:05:17 
05:05:17 Retrieving / parsing channel-families data
05:05:19 channel-families data complete
05:05:19 
05:05:19 Retrieving / parsing product names data
05:05:19 product names data complete
05:05:19 
05:05:19 Retrieving / parsing arches data
05:05:20 arches data complete
05:05:20 
05:05:20 Retrieving / parsing additional arches data
05:05:21 additional arches data complete
05:05:21 
05:05:21 Retrieving / parsing channel data
05:05:21    p = previously imported/synced channel
05:05:21    . = channel not yet imported/synced
05:05:21    base-channels:
05:05:21       . rhel-x86_64-server-7                        0       full import from Wed Aug 16 04:55:37 2017
05:05:21 
05:05:21 Channel data complete
    Import complete:
        Begin time: Wed Aug 16 05:05:16 2017
        End time:   Wed Aug 16 05:05:21 2017
        Elapsed:    0 hours, 0 minutes, 4 seconds
          
[root@dell-pem805-01 ~]# echo -e "select id,label,product_name_id,channel_product_id from rhnChannel;\nselect * from rhnProductName;\nselect * from rhnChannelProduct;" | spacewalk-sql -i
 id  |        label         | product_name_id | channel_product_id 
-----+----------------------+-----------------+--------------------
 116 | rhel-x86_64-server-7 |             111 |                  1
(1 row)

 id  |   label   |       name       |            created            |           modified            
-----+-----------+------------------+-------------------------------+-------------------------------
 111 | rhel      | Enterprise Linux | 2017-08-16 05:05:19.878224-04 | 2017-08-16 05:05:19.878224-04
 112 | proxy     | Network Proxy    | 2017-08-16 05:05:19.878224-04 | 2017-08-16 05:05:19.878224-04
 113 | rhn-tools | Network Tools    | 2017-08-16 05:05:19.878224-04 | 2017-08-16 05:05:19.878224-04
(3 rows)

 id | product | version | beta |            created            |           modified            
----+---------+---------+------+-------------------------------+-------------------------------
  1 | rhel    | 7       | N    | 2017-08-14 09:04:10.998676-04 | 2017-08-14 09:04:10.998676-04
(1 row)

VERIFIED

Comment 12 Lukáš Hellebrandt 2017-08-29 10:09:37 UTC
Re-verified.

# on both satellites:
# rpm -qf spacewalk-backend
spacewalk-backend-2.5.3-151.

# === satellite-sync against another updated 5.8: ===
# satellite-sync --iss-parent <another_58_fqdn> -c rhel-x86_64-server-5 --no-errata --no-rpms --no-packages --no-kickstarts
[...]
          
[root@hp-dl380pgen8-02-vm-12 ~]# echo -e "select id,label,product_name_id,channel_product_id from rhnChannel;\nselect * from rhnProductName;\nselect * from rhnChannelProduct;" | spacewalk-sql -i
 id  |        label         | product_name_id | channel_product_id 
-----+----------------------+-----------------+--------------------
 189 | rhel-x86_64-server-5 |             117 |                  7
(1 row)

 id  |      label      |                     name                      |            created            |           modified            
-----+-----------------+-----------------------------------------------+-------------------------------+-------------------------------
 117 | rhel            | Enterprise Linux                              | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 118 | proxy           | Network Proxy                                 | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 119 | rhn-tools       | Network Tools                                 | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 120 | extras          | Extras                                        | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 121 | vt-multi        | Desktop Multi-OS                              | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 122 | cluster         | Cluster Suite                                 | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 123 | rhev-h-6        | Enterprise Virtualization Hypervisor (RHEV 3) | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 124 | satellite       | Network Satellite                             | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 125 | sap             | SAP                                           | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 126 | rhn-tools-debug | Network Tools Debuginfo                       | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 127 | rhel-htb        | Enterprise Linux High Touch                   | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 128 | vt              | Virtualization                                | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
 129 | optional        | Optional                                      | 2017-08-29 05:45:39.316509-04 | 2017-08-29 05:45:39.316509-04
(13 rows)

 id | product | version | beta |            created            |           modified            
----+---------+---------+------+-------------------------------+-------------------------------
  7 | rhel    | 5       | N    | 2017-08-29 05:45:48.279093-04 | 2017-08-29 05:45:48.279093-04
(1 row)


# === satellite-sync from self-created dump: ===
# rhn-satellite-exporter -c rhel-x86_64-server-5 -d dump/
[...]
# spacewalk-remove-channel -c rhel-x86_64-server-5
(reverse-i-search)`delete': echo -e "delete from rhnproductname; ^Clete from rhnchannelproduct;" | spacewalk-sql -i
# echo -e "delete from rhnproductname; delete from rhnchannelproduct;" | spacewalk-sql -iDELETE 13
DELETE 1
# satellite-sync -m dump/ -c rhel-x86_64-server-5
[...]
# echo -e "select id,label,product_name_id,channel_product_id from rhnChannel;\nselect * from rhnProductName;\nselect * from rhnChannelProduct;" | spacewalk-sql -i
 id  |        label         | product_name_id | channel_product_id 
-----+----------------------+-----------------+--------------------
 190 | rhel-x86_64-server-5 |             130 |                  8
(1 row)

 id  | label |       name       |           created            |           modified           
-----+-------+------------------+------------------------------+------------------------------
 130 | rhel  | Enterprise Linux | 2017-08-29 06:03:03.46934-04 | 2017-08-29 06:03:03.46934-04
(1 row)

 id | product | version | beta |            created            |           modified            
----+---------+---------+------+-------------------------------+-------------------------------
  8 | rhel    | 5       | N    | 2017-08-29 06:03:03.582586-04 | 2017-08-29 06:03:03.582586-04
(1 row)




Note there is only the synced channel's product_name_id when syncing from dump, as opposed to syncing from another satellite (comment 8). This is intended behavior (according to jdobes).

Comment 13 errata-xmlrpc 2017-09-06 12:27:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2645


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