RedHatSatellite / katello-cvmanager

manage Katello content views
GNU General Public License v2.0
49 stars 31 forks source link

Updating CCV terminates with error: #35

Open sandersr opened 7 years ago

sandersr commented 7 years ago
./cvmanager --wait update -n
Inspecting ALL CentOS6 Updates
./cvmanager:223:in `initialize': no implicit conversion from nil to integer (TypeError)
        from ./cvmanager:223:in `new'
        from ./cvmanager:223:in `block in update'
        from ./cvmanager:215:in `each'
        from ./cvmanager:215:in `update'
        from ./cvmanager:481:in `<main>'

my config file:

---
:settings:
  :user: admin
  :pass: changeme
  :uri: https://localhost
  :timeout: 300
  :org: 3
  :lifecycle: 5
  :keep: 2
:ccv:
  ALL CentOS7 Updates:
    Bareos Updates EL7: latest
    OS updates EL7: latest
    Puppet Updates EL7: latest
    Zabbix Updates EL7: latest
    Katello Client Updates EL7: latest
  ALL CentOS6 Updates:
    Bareos Updates EL6: latest
    OS updates EL6: latest
    Puppet Updates EL6: latest
    Zabbix Updates EL6: latest
    Katello Client Updates EL6: latest
:publish:
  - Bareos Updates EL7
  - OS updates EL7
  - Puppet Updates EL7
  - Zabbix Updates EL7
  - Katello Client Updates EL7
  - Bareos Updates EL6
  - OS updates EL6
  - Puppet Updates EL6
  - Zabbix Updates EL6
  - Katello Client Updates EL6
  - OS Updates Fedora 25
:promote:
  - OS Updates Fedora 25
  - ALL CentOS7 Updates 
  - ALL CentOS6 Updates 
evgeni commented 7 years ago

Quoting from IRC:

13:16 < sonicblaze> sandersr: Do you have a composite content view that doesn't have any member content views? that's what that line would suggest
13:17 < sandersr> sonicblaze: nope. I've got only 2 composite content views and both contain 5 CVs each
13:18 < sandersr> I've created an issue here: https://github.com/RedHatSatellite/katello-cvmanager/issues/35 but talking about it here might be faster
16:35 < Zhenech> sandersr, sonic's guess is also what I would have said.

Line 223 reads:

    ids = Array.new(ccv['component_ids'])

and that will error out if ccv['component_ids'] is nil.

can you add the following lines before line 223 and show us the output?

puts ccv['component_ids']
puts ccv['components']
sandersr commented 7 years ago

Changed the code to:

    puts "Inspecting #{ccv['name']}"
    puts "Listing IDS:"
    puts ccv['component_ids']
    puts "Listing components:"
    puts ccv['components'] 

Output result:

./cvmanager update -n
Inspecting ALL_CentOS6_Updates
Listing IDS:

Listing components:
{"id"=>41, "name"=>"Bareos_Updates_EL6 2.0", "content_view_id"=>12, "version"=>"2.0", "puppet_module_count"=>0, "environments"=>[{"id"=>4, "name"=>"Library", "label"=>"Library"}], "content_view"=>{"id"=>12, "name"=>"Bareos_Updates_EL6", "label"=>"Bareos_Updates_EL6", "description"=>nil, "next_version"=>3, "latest_version"=>"2.0"}, "repositories"=>[{"id"=>330, "name"=>"16.2", "label"=>"16_2"}]}
{"id"=>43, "name"=>"OS_updates_EL6 3.0", "content_view_id"=>13, "version"=>"3.0", "puppet_module_count"=>0, "environments"=>[{"id"=>4, "name"=>"Library", "label"=>"Library"}], "content_view"=>{"id"=>13, "name"=>"OS_updates_EL6", "label"=>"OS_updates_EL6", "description"=>nil, "next_version"=>4, "latest_version"=>"3.0"}, "repositories"=>[{"id"=>332, "name"=>"x86_64", "label"=>"x86_64"}, {"id"=>333, "name"=>"sclo x86_64 sclo", "label"=>"sclo_x86_64_sclo"}, {"id"=>334, "name"=>"updates x86_64", "label"=>"updates_x86_64"}, {"id"=>335, "name"=>"sclo x86_64 rh", "label"=>"sclo_x86_64_rh"}, {"id"=>336, "name"=>"os x86_64", "label"=>"os_x86_64"}]}
{"id"=>44, "name"=>"Puppet_Updates_EL6 2.0", "content_view_id"=>14, "version"=>"2.0", "puppet_module_count"=>0, "environments"=>[{"id"=>4, "name"=>"Library", "label"=>"Library"}], "content_view"=>{"id"=>14, "name"=>"Puppet_Updates_EL6", "label"=>"Puppet_Updates_EL6", "description"=>nil, "next_version"=>3, "latest_version"=>"2.0"}, "repositories"=>[{"id"=>337, "name"=>"PC1", "label"=>"PC1"}]}
{"id"=>45, "name"=>"Zabbix_Updates_EL6 2.0", "content_view_id"=>15, "version"=>"2.0", "puppet_module_count"=>0, "environments"=>[{"id"=>4, "name"=>"Library", "label"=>"Library"}], "content_view"=>{"id"=>15, "name"=>"Zabbix_Updates_EL6", "label"=>"Zabbix_Updates_EL6", "description"=>nil, "next_version"=>3, "latest_version"=>"2.0"}, "repositories"=>[{"id"=>338, "name"=>"3.2", "label"=>"3_2"}]}
{"id"=>42, "name"=>"Katello_Client_Updates_EL6 2.0", "content_view_id"=>17, "version"=>"2.0", "puppet_module_count"=>0, "environments"=>[{"id"=>4, "name"=>"Library", "label"=>"Library"}], "content_view"=>{"id"=>17, "name"=>"Katello_Client_Updates_EL6", "label"=>"Katello_Client_Updates_EL6", "description"=>nil, "next_version"=>3, "latest_version"=>"2.0"}, "repositories"=>[{"id"=>331, "name"=>"3.3", "label"=>"3_3"}]}
./cvmanager:227:in `initialize': no implicit conversion from nil to integer (TypeError)
        from ./cvmanager:227:in `new'
        from ./cvmanager:227:in `block in update'
        from ./cvmanager:215:in `each'
        from ./cvmanager:215:in `update'
        from ./cvmanager:485:in `<main>'
sandersr commented 7 years ago

Any idea how to find out what's causing the problem?

evgeni commented 7 years ago

Well, I would have expected the content_ids to be [41,42,43,44,45] not nil... I have not the slightest idea why it is nil here.

evgeni commented 7 years ago

Can you try:

-     ids = Array.new(ccv['component_ids'])
+     ids = Array.new(ccv['components'].flat_map{|i| i['id']})

This should get the IDs from components, not from component_ids.

evgeni commented 7 years ago

Might be related to http://projects.theforeman.org/issues/18820?

sandersr commented 7 years ago

@evgeni this patch made it work but not quite. It's not throwing an error any more but it's not updating nor promoting anything.

./cvmanager --wait update
Inspecting ALL_CentOS6_Updates
 Checking Bareos_Updates_EL6
 Checking OS_updates_EL6
 Checking Puppet_Updates_EL6
 Checking Zabbix_Updates_EL6
 Checking Katello_Client_Updates_EL6
Inspecting ALL_CentOS7_Updates
 Checking Bareos_Updates_EL7
 Checking OS_updates_EL7
 Checking Puppet_Updates_EL7
 Checking Zabbix_Updates_EL7
 Checking Katello_Client_Updates_EL7

./cvmanager --wait promote 
Inspecting ALL_CentOS6_Updates
Inspecting ALL_CentOS7_Updates

publish command works as expected tho.

evgeni commented 7 years ago

Good that the patch helped. The other part is maybe https://github.com/RedHatSatellite/katello-cvmanager/issues/23? cvmanager sadly uses name/label inconsistently. update uses labels, but publish and promote uses names.

sandersr commented 7 years ago

I've seen this issue a few days ago, so I've updated my names to match my labels. Makes no difference.

evgeni commented 7 years ago

Can you post --verbose output please?

sandersr commented 7 years ago

No difference. Gives me the same output.

evgeni commented 7 years ago

Do you have the latest version? update got verbose support in https://github.com/RedHatSatellite/katello-cvmanager/commit/7054ac58eebeb06b6cedcde75dee797b7fa87b34, promote does not have any though.

sandersr commented 7 years ago

Sorry, I thought you were asking about promote --verbose.

./cvmanager --wait publish --verbose
    [VERBOSE] Checking Content View ALL_CentOS6_Updates
    [VERBOSE] Checking Content View ALL_CentOS7_Updates
    [VERBOSE] Checking Content View Bareos_Updates_EL6
Inspecting Bareos_Updates_EL6 as listed in CSV
 repo 16_2 (id: 17) seems newer than CV Bareos_Updates_EL6 (id: 12) (2017-04-24 02:01:02 UTC > 2017-04-12 19:52:14 UTC), lets publish
Publishing Bareos_Updates_EL6
    [VERBOSE] Checking Content View Bareos_Updates_EL7
Inspecting Bareos_Updates_EL7 as listed in CSV
 repo 16_2 (id: 22) seems newer than CV Bareos_Updates_EL7 (id: 10) (2017-04-24 02:01:17 UTC > 2017-04-12 19:52:17 UTC), lets publish
Publishing Bareos_Updates_EL7
    [VERBOSE] Checking Content View Default Organization View
    [VERBOSE] Checking Content View EL6_Netezza_server
    [VERBOSE] Checking Content View Katello_Client_Updates_EL6
Inspecting Katello_Client_Updates_EL6 as listed in CSV
 repo 3_3 (id: 157) seems newer than CV Katello_Client_Updates_EL6 (id: 17) (2017-04-24 02:01:25 UTC > 2017-04-12 19:52:20 UTC), lets publish
Publishing Katello_Client_Updates_EL6
    [VERBOSE] Checking Content View Katello_Client_Updates_EL7
Inspecting Katello_Client_Updates_EL7 as listed in CSV
 repo 3_3 (id: 156) seems newer than CV Katello_Client_Updates_EL7 (id: 18) (2017-04-24 02:01:04 UTC > 2017-04-12 19:52:22 UTC), lets publish
Publishing Katello_Client_Updates_EL7
    [VERBOSE] Checking Content View OS_updates_EL6
Inspecting OS_updates_EL6 as listed in CSV
 repo x86_64 (id: 23) seems newer than CV OS_updates_EL6 (id: 13) (2017-04-24 02:05:58 UTC > 2017-04-12 14:23:54 UTC), lets publish
 repo sclo_x86_64_sclo (id: 9) seems newer than CV OS_updates_EL6 (id: 13) (2017-04-24 01:01:41 UTC > 2017-04-12 14:23:54 UTC), lets publish
 repo updates_x86_64 (id: 10) seems newer than CV OS_updates_EL6 (id: 13) (2017-04-24 01:01:31 UTC > 2017-04-12 14:23:54 UTC), lets publish
 repo sclo_x86_64_rh (id: 8) seems newer than CV OS_updates_EL6 (id: 13) (2017-04-24 01:01:45 UTC > 2017-04-12 14:23:54 UTC), lets publish
 repo os_x86_64 (id: 7) seems newer than CV OS_updates_EL6 (id: 13) (2017-04-24 01:02:28 UTC > 2017-04-12 14:23:54 UTC), lets publish
Publishing OS_updates_EL6
    [VERBOSE] Checking Content View OS_updates_EL7
Inspecting OS_updates_EL7 as listed in CSV
 repo sclo_x86_64_rh (id: 19) seems newer than CV OS_updates_EL7 (id: 7) (2017-04-24 01:01:53 UTC > 2017-04-12 19:52:26 UTC), lets publish
 repo os_x86_64 (id: 18) seems newer than CV OS_updates_EL7 (id: 7) (2017-04-24 01:02:54 UTC > 2017-04-12 19:52:26 UTC), lets publish
 repo x86_64 (id: 24) seems newer than CV OS_updates_EL7 (id: 7) (2017-04-24 02:05:52 UTC > 2017-04-12 19:52:26 UTC), lets publish
 repo sclo_x86_64_sclo (id: 20) seems newer than CV OS_updates_EL7 (id: 7) (2017-04-24 01:01:42 UTC > 2017-04-12 19:52:26 UTC), lets publish
 repo updates_x86_64 (id: 21) seems newer than CV OS_updates_EL7 (id: 7) (2017-04-24 01:02:08 UTC > 2017-04-12 19:52:26 UTC), lets publish
Publishing OS_updates_EL7
    [VERBOSE] Checking Content View OS_Updates_Fedora_25
Inspecting OS_Updates_Fedora_25 as listed in CSV
    [VERBOSE] Checking Content View Puppet_Updates_EL6
Inspecting Puppet_Updates_EL6 as listed in CSV
 repo PC1 (id: 13) seems newer than CV Puppet_Updates_EL6 (id: 14) (2017-04-24 01:01:34 UTC > 2017-04-12 19:53:48 UTC), lets publish
Publishing Puppet_Updates_EL6
    [VERBOSE] Checking Content View Puppet_Updates_EL7
Inspecting Puppet_Updates_EL7 as listed in CSV
 repo PC1 (id: 14) seems newer than CV Puppet_Updates_EL7 (id: 8) (2017-04-24 01:01:38 UTC > 2017-04-12 19:53:51 UTC), lets publish
Publishing Puppet_Updates_EL7
    [VERBOSE] Checking Content View Zabbix_Updates_EL6
Inspecting Zabbix_Updates_EL6 as listed in CSV
 repo 3_2 (id: 12) seems newer than CV Zabbix_Updates_EL6 (id: 15) (2017-04-24 02:01:11 UTC > 2017-04-12 19:53:57 UTC), lets publish
Publishing Zabbix_Updates_EL6
    [VERBOSE] Checking Content View Zabbix_Updates_EL7
Inspecting Zabbix_Updates_EL7 as listed in CSV
 repo 3_2 (id: 16) seems newer than CV Zabbix_Updates_EL7 (id: 9) (2017-04-24 02:01:18 UTC > 2017-04-12 19:54:00 UTC), lets publish
Publishing Zabbix_Updates_EL7
waiting 10 for pending tasks: ["cba1935b-4525-400d-bae4-bd320b7e7f59", "b003d29a-cf98-4bb8-a54b-98f18b38223b", "e75f8312-39df-4754-9fbf-fb0383a3dc66", "e216d2e8-bcfa-4505-9ac3-dd0a310b9e4a", "8edb07b3-3477-4503-8ce7-ddf76408563b", "9552dc4b-1d9d-4017-95c8-6f3b61f6713a", "165e6389-1cff-4978-b36f-5a09cf7ad2c4", "09cd4d88-adcf-4eeb-bd40-21b8ebaa1408", "a085a8bf-c0c2-4964-8073-4d83472c2a90", "826ca235-7b26-4ff7-855c-64aebef926e2"]
waiting 20 for pending tasks: ["e75f8312-39df-4754-9fbf-fb0383a3dc66", "e216d2e8-bcfa-4505-9ac3-dd0a310b9e4a", "8edb07b3-3477-4503-8ce7-ddf76408563b", "9552dc4b-1d9d-4017-95c8-6f3b61f6713a", "165e6389-1cff-4978-b36f-5a09cf7ad2c4", "09cd4d88-adcf-4eeb-bd40-21b8ebaa1408", "a085a8bf-c0c2-4964-8073-4d83472c2a90", "826ca235-7b26-4ff7-855c-64aebef926e2"]
waiting 30 for pending tasks: ["e216d2e8-bcfa-4505-9ac3-dd0a310b9e4a", "8edb07b3-3477-4503-8ce7-ddf76408563b", "9552dc4b-1d9d-4017-95c8-6f3b61f6713a", "165e6389-1cff-4978-b36f-5a09cf7ad2c4", "09cd4d88-adcf-4eeb-bd40-21b8ebaa1408", "a085a8bf-c0c2-4964-8073-4d83472c2a90", "826ca235-7b26-4ff7-855c-64aebef926e2"]
waiting 40 for pending tasks: ["8edb07b3-3477-4503-8ce7-ddf76408563b", "9552dc4b-1d9d-4017-95c8-6f3b61f6713a", "165e6389-1cff-4978-b36f-5a09cf7ad2c4", "09cd4d88-adcf-4eeb-bd40-21b8ebaa1408", "a085a8bf-c0c2-4964-8073-4d83472c2a90", "826ca235-7b26-4ff7-855c-64aebef926e2"]
waiting 50 for pending tasks: ["8edb07b3-3477-4503-8ce7-ddf76408563b", "9552dc4b-1d9d-4017-95c8-6f3b61f6713a", "165e6389-1cff-4978-b36f-5a09cf7ad2c4", "09cd4d88-adcf-4eeb-bd40-21b8ebaa1408", "a085a8bf-c0c2-4964-8073-4d83472c2a90", "826ca235-7b26-4ff7-855c-64aebef926e2"]
waiting 60 for pending tasks: ["8edb07b3-3477-4503-8ce7-ddf76408563b", "9552dc4b-1d9d-4017-95c8-6f3b61f6713a"]
Silencing output until there's a task status change...
waiting 60 for pending tasks: ["9552dc4b-1d9d-4017-95c8-6f3b61f6713a"]
./cvmanager --wait update --verbose
Inspecting ALL_CentOS6_Updates
 Checking Bareos_Updates_EL6
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 4.0 as the 'latest' version
 Checking OS_updates_EL6
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 5.0 as the 'latest' version
 Checking Puppet_Updates_EL6
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 4.0 as the 'latest' version
 Checking Zabbix_Updates_EL6
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 4.0 as the 'latest' version
 Checking Katello_Client_Updates_EL6
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 4.0 as the 'latest' version
Inspecting ALL_CentOS7_Updates
 Checking Bareos_Updates_EL7
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 4.0 as the 'latest' version
 Checking OS_updates_EL7
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 5.0 as the 'latest' version
 Checking Puppet_Updates_EL7
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 4.0 as the 'latest' version
 Checking Zabbix_Updates_EL7
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 4.0 as the 'latest' version
 Checking Katello_Client_Updates_EL7
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 4.0 as the 'latest' version

At this point I would expect it to create a new version for ALL_CentOS6_Updates and ALL_CentOS7_Updates but it doesn't.

./cvmanager --wait promote --verbose
Inspecting ALL_CentOS6_Updates
Inspecting ALL_CentOS7_Updates
evgeni commented 7 years ago

So it thinks that all the components are already at the latest version, and thus no update is required. Which obviously does not match the publish run you had before that.

Can you post the output of hammer content-view version list --content-view "Default Organization View" --organization "Default Organization" for some of the involved content views?

sandersr commented 7 years ago

When I manually create a new version of CCV, promote action works as expected.

It seems that only --update action is not playing ball.

I will have to demote and remove newly (manually) created CCV to post the logs you requested.

evgeni commented 7 years ago

I think I know where you issue is coming from. Will post a test-patch later.

sandersr commented 7 years ago

The list you requested:

for a in ` ./cvmanager --wait update | awk '{print $2}'`; do hammer -p XXXXXX  content-view version list --content-view $a --organization-id 3; done
---|-------------------------|---------|-----------------------
ID | NAME                    | VERSION | LIFECYCLE ENVIRONMENTS
---|-------------------------|---------|-----------------------
48 | ALL_CentOS6_Updates 4.0 | 4.0     | Library, DEV, PROD    
29 | ALL_CentOS6_Updates 3.0 | 3.0     |                       
19 | ALL_CentOS6_Updates 2.0 | 2.0     |                       
---|-------------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
62 | Bareos_Updates_EL6 4.0 | 4.0     | Library               
51 | Bareos_Updates_EL6 3.0 | 3.0     |                       
41 | Bareos_Updates_EL6 2.0 | 2.0     | DEV, PROD             
11 | Bareos_Updates_EL6 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|--------------------|---------|-----------------------
ID | NAME               | VERSION | LIFECYCLE ENVIRONMENTS
---|--------------------|---------|-----------------------
66 | OS_updates_EL6 5.0 | 5.0     | Library               
47 | OS_updates_EL6 4.0 | 4.0     | DEV, PROD             
43 | OS_updates_EL6 3.0 | 3.0     |                       
28 | OS_updates_EL6 2.0 | 2.0     |                       
14 | OS_updates_EL6 1.0 | 1.0     |                       
---|--------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
68 | Puppet_Updates_EL6 4.0 | 4.0     | Library               
57 | Puppet_Updates_EL6 3.0 | 3.0     |                       
44 | Puppet_Updates_EL6 2.0 | 2.0     | DEV, PROD             
12 | Puppet_Updates_EL6 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
70 | Zabbix_Updates_EL6 4.0 | 4.0     | Library               
59 | Zabbix_Updates_EL6 3.0 | 3.0     |                       
45 | Zabbix_Updates_EL6 2.0 | 2.0     | DEV, PROD             
13 | Zabbix_Updates_EL6 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|--------------------------------|---------|-----------------------
ID | NAME                           | VERSION | LIFECYCLE ENVIRONMENTS
---|--------------------------------|---------|-----------------------
64 | Katello_Client_Updates_EL6 4.0 | 4.0     | Library               
53 | Katello_Client_Updates_EL6 3.0 | 3.0     |                       
42 | Katello_Client_Updates_EL6 2.0 | 2.0     | DEV, PROD             
16 | Katello_Client_Updates_EL6 1.0 | 1.0     |                       
---|--------------------------------|---------|-----------------------
---|-------------------------|---------|-----------------------
ID | NAME                    | VERSION | LIFECYCLE ENVIRONMENTS
---|-------------------------|---------|-----------------------
50 | ALL_CentOS7_Updates 4.0 | 4.0     | Library, DEV, PROD    
26 | ALL_CentOS7_Updates 3.0 | 3.0     |                       
18 | ALL_CentOS7_Updates 2.0 | 2.0     |                       
---|-------------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
63 | Bareos_Updates_EL7 4.0 | 4.0     | Library               
52 | Bareos_Updates_EL7 3.0 | 3.0     |                       
36 | Bareos_Updates_EL7 2.0 | 2.0     | DEV, PROD             
6  | Bareos_Updates_EL7 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|--------------------|---------|-----------------------
ID | NAME               | VERSION | LIFECYCLE ENVIRONMENTS
---|--------------------|---------|-----------------------
67 | OS_updates_EL7 5.0 | 5.0     | Library               
55 | OS_updates_EL7 4.0 | 4.0     |                       
38 | OS_updates_EL7 3.0 | 3.0     | DEV, PROD             
25 | OS_updates_EL7 2.0 | 2.0     |                       
7  | OS_updates_EL7 1.0 | 1.0     |                       
---|--------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
69 | Puppet_Updates_EL7 4.0 | 4.0     | Library               
58 | Puppet_Updates_EL7 3.0 | 3.0     |                       
39 | Puppet_Updates_EL7 2.0 | 2.0     | DEV, PROD             
8  | Puppet_Updates_EL7 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
71 | Zabbix_Updates_EL7 4.0 | 4.0     | Library               
60 | Zabbix_Updates_EL7 3.0 | 3.0     |                       
40 | Zabbix_Updates_EL7 2.0 | 2.0     | DEV, PROD             
9  | Zabbix_Updates_EL7 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|--------------------------------|---------|-----------------------
ID | NAME                           | VERSION | LIFECYCLE ENVIRONMENTS
---|--------------------------------|---------|-----------------------
65 | Katello_Client_Updates_EL7 4.0 | 4.0     | Library               
54 | Katello_Client_Updates_EL7 3.0 | 3.0     |                       
37 | Katello_Client_Updates_EL7 2.0 | 2.0     | DEV, PROD             
17 | Katello_Client_Updates_EL7 1.0 | 1.0     |                       
---|--------------------------------|---------|-----------------------
sandersr commented 7 years ago

Did you have any luck with the patch?

evgeni commented 7 years ago

So I was thinking of something like this:

diff --git a/cvmanager b/cvmanager
index bf2d19c..563ce8e 100755
--- a/cvmanager
+++ b/cvmanager
@@ -242,7 +242,8 @@ def update()
       # instead of hard-coding the versions, the user can also specify "latest"
       if desired_version == 'latest'
         cvversions = @api.resource(:content_view_versions).call(:index, {:content_view_id => component['content_view']['id']})
-        desired_version = cvversions['results'][0]['version']
+        cvversions = cvversions['results'].sort_by { |v| v['version'].to_f }.reverse
+        desired_version = cvversions[0]['version']
         puts_verbose "  Found #{desired_version} as the 'latest' version"
       end

However, your output above suggests that 4.0 is actually the newest version for most of the CVs?

sandersr commented 7 years ago

ok, I've added a few more versions for each CV. The output now:

for a in ` ./cvmanager --wait update | awk '{print $2}'`; do hammer -p XXXXXXX  content-view version list --content-view $a --organization-id 3; done
---|-------------------------|---------|-----------------------
ID | NAME                    | VERSION | LIFECYCLE ENVIRONMENTS
---|-------------------------|---------|-----------------------
48 | ALL_CentOS6_Updates 4.0 | 4.0     | Library, DEV, PROD    
29 | ALL_CentOS6_Updates 3.0 | 3.0     |                       
19 | ALL_CentOS6_Updates 2.0 | 2.0     |                       
---|-------------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
86 | Bareos_Updates_EL6 6.0 | 6.0     | Library               
75 | Bareos_Updates_EL6 5.0 | 5.0     |                       
62 | Bareos_Updates_EL6 4.0 | 4.0     |                       
51 | Bareos_Updates_EL6 3.0 | 3.0     |                       
41 | Bareos_Updates_EL6 2.0 | 2.0     | DEV, PROD             
11 | Bareos_Updates_EL6 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|--------------------|---------|-----------------------
ID | NAME               | VERSION | LIFECYCLE ENVIRONMENTS
---|--------------------|---------|-----------------------
90 | OS_updates_EL6 8.0 | 8.0     | Library               
79 | OS_updates_EL6 7.0 | 7.0     |                       
66 | OS_updates_EL6 5.0 | 5.0     |                       
47 | OS_updates_EL6 4.0 | 4.0     | DEV, PROD             
43 | OS_updates_EL6 3.0 | 3.0     |                       
28 | OS_updates_EL6 2.0 | 2.0     |                       
14 | OS_updates_EL6 1.0 | 1.0     |                       
---|--------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
93 | Puppet_Updates_EL6 6.0 | 6.0     | Library               
82 | Puppet_Updates_EL6 5.0 | 5.0     |                       
68 | Puppet_Updates_EL6 4.0 | 4.0     |                       
57 | Puppet_Updates_EL6 3.0 | 3.0     |                       
44 | Puppet_Updates_EL6 2.0 | 2.0     | DEV, PROD             
12 | Puppet_Updates_EL6 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
95 | Zabbix_Updates_EL6 6.0 | 6.0     | Library               
84 | Zabbix_Updates_EL6 5.0 | 5.0     |                       
70 | Zabbix_Updates_EL6 4.0 | 4.0     |                       
59 | Zabbix_Updates_EL6 3.0 | 3.0     |                       
45 | Zabbix_Updates_EL6 2.0 | 2.0     | DEV, PROD             
13 | Zabbix_Updates_EL6 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|--------------------------------|---------|-----------------------
ID | NAME                           | VERSION | LIFECYCLE ENVIRONMENTS
---|--------------------------------|---------|-----------------------
88 | Katello_Client_Updates_EL6 6.0 | 6.0     | Library               
77 | Katello_Client_Updates_EL6 5.0 | 5.0     |                       
64 | Katello_Client_Updates_EL6 4.0 | 4.0     |                       
53 | Katello_Client_Updates_EL6 3.0 | 3.0     |                       
42 | Katello_Client_Updates_EL6 2.0 | 2.0     | DEV, PROD             
16 | Katello_Client_Updates_EL6 1.0 | 1.0     |                       
---|--------------------------------|---------|-----------------------
---|-------------------------|---------|-----------------------
ID | NAME                    | VERSION | LIFECYCLE ENVIRONMENTS
---|-------------------------|---------|-----------------------
50 | ALL_CentOS7_Updates 4.0 | 4.0     | Library, DEV, PROD    
26 | ALL_CentOS7_Updates 3.0 | 3.0     |                       
18 | ALL_CentOS7_Updates 2.0 | 2.0     |                       
---|-------------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
87 | Bareos_Updates_EL7 6.0 | 6.0     | Library               
76 | Bareos_Updates_EL7 5.0 | 5.0     |                       
63 | Bareos_Updates_EL7 4.0 | 4.0     |                       
52 | Bareos_Updates_EL7 3.0 | 3.0     |                       
36 | Bareos_Updates_EL7 2.0 | 2.0     | DEV, PROD             
6  | Bareos_Updates_EL7 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|--------------------|---------|-----------------------
ID | NAME               | VERSION | LIFECYCLE ENVIRONMENTS
---|--------------------|---------|-----------------------
91 | OS_updates_EL7 7.0 | 7.0     | Library               
80 | OS_updates_EL7 6.0 | 6.0     |                       
67 | OS_updates_EL7 5.0 | 5.0     |                       
55 | OS_updates_EL7 4.0 | 4.0     |                       
38 | OS_updates_EL7 3.0 | 3.0     | DEV, PROD             
25 | OS_updates_EL7 2.0 | 2.0     |                       
7  | OS_updates_EL7 1.0 | 1.0     |                       
---|--------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
94 | Puppet_Updates_EL7 6.0 | 6.0     | Library               
83 | Puppet_Updates_EL7 5.0 | 5.0     |                       
69 | Puppet_Updates_EL7 4.0 | 4.0     |                       
58 | Puppet_Updates_EL7 3.0 | 3.0     |                       
39 | Puppet_Updates_EL7 2.0 | 2.0     | DEV, PROD             
8  | Puppet_Updates_EL7 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|------------------------|---------|-----------------------
ID | NAME                   | VERSION | LIFECYCLE ENVIRONMENTS
---|------------------------|---------|-----------------------
96 | Zabbix_Updates_EL7 6.0 | 6.0     | Library               
85 | Zabbix_Updates_EL7 5.0 | 5.0     |                       
71 | Zabbix_Updates_EL7 4.0 | 4.0     |                       
60 | Zabbix_Updates_EL7 3.0 | 3.0     |                       
40 | Zabbix_Updates_EL7 2.0 | 2.0     | DEV, PROD             
9  | Zabbix_Updates_EL7 1.0 | 1.0     |                       
---|------------------------|---------|-----------------------
---|--------------------------------|---------|-----------------------
ID | NAME                           | VERSION | LIFECYCLE ENVIRONMENTS
---|--------------------------------|---------|-----------------------
89 | Katello_Client_Updates_EL7 6.0 | 6.0     | Library               
78 | Katello_Client_Updates_EL7 5.0 | 5.0     |                       
65 | Katello_Client_Updates_EL7 4.0 | 4.0     |                       
54 | Katello_Client_Updates_EL7 3.0 | 3.0     |                       
37 | Katello_Client_Updates_EL7 2.0 | 2.0     | DEV, PROD             
17 | Katello_Client_Updates_EL7 1.0 | 1.0     |                       
---|--------------------------------|---------|-----------------------

After the patch, update actions hasn't changed.

./cvmanager --wait update --verbose
Inspecting ALL_CentOS6_Updates
 Checking Bareos_Updates_EL6
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 6.0 as the 'latest' version
 Checking OS_updates_EL6
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 8.0 as the 'latest' version
 Checking Puppet_Updates_EL6
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 6.0 as the 'latest' version
 Checking Zabbix_Updates_EL6
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 6.0 as the 'latest' version
 Checking Katello_Client_Updates_EL6
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 6.0 as the 'latest' version
Inspecting ALL_CentOS7_Updates
 Checking Bareos_Updates_EL7
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 6.0 as the 'latest' version
 Checking OS_updates_EL7
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 7.0 as the 'latest' version
 Checking Puppet_Updates_EL7
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 6.0 as the 'latest' version
 Checking Zabbix_Updates_EL7
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 6.0 as the 'latest' version
 Checking Katello_Client_Updates_EL7
    [VERBOSE]   Desired version latest found in CCV
    [VERBOSE]   Found 6.0 as the 'latest' version

Maybe I don't understand how it's supposed to work. I believe - based on the docs I've read - that "update" should publish a new version of CCV matching the latest versions of CV and promote should push this new version to DEV or PROD env. Am I wrong here?

evgeni commented 7 years ago

So the idea is that you have CVs for your content parts, serve CCVs to your clients, and cvmanager keeps the CVs in the CCVs uptodate. So the workflow would be:

  1. manually update a CV to have new content or do a publish
  2. run update to have the CCVs set to the new version of the CV you changed before
  3. run promote to push out the CCV to the other lifecycles

So taking OS_updates_EL6 as an example above: you created version 8.0 somehow, update makes sure ALL_CentOS6_Updates contains v8, promote pushes it to the next lifecycle.

But in your paste it seems that ALL_CentOS6_Updates already contains v8 of OS_updates_EL6 so cvmanager does nothing.

sandersr commented 7 years ago

My setup matches your description. All hosts use CCV - either ALL_CentOS6_Updates or ALL_CentOS7_Updates. I based my setup on "Fully automated CCV for automated patching" example

So what I've done is:

1) run publish - new version of CV are added to the Library env (lots of new packages available) 2) run update - CCVs tell me they're using the latest versions 3) run promote - nothing happens

The client has no new updates available. What am I missing?

jviau-fuze commented 6 years ago

I encountered this issue recently while trying to set up the tool. Solution ( for me) was to change the component versions of my composite content view from "latest" to a version number. the publish, update,promote workflow worked perfectly after that.

cheeseburger12 commented 6 years ago

hi @sandersr, i have the same Problem with the CCVs update. I have all my repos in CCV_ALL_6 and CCV_ALL_7. The CV are already up to date, but the CCVs, what my clients will see don't have the latest version. Do you have allready a solution for this Problem? ` Checking cv-centos6 [VERBOSE] Desired version latest found in CCV [VERBOSE] Found 5.0 as the 'latest' version

Checking cv_mariadb_6 [VERBOSE] Desired version latest found in CCV [VERBOSE] Found 2.0 as the 'latest' version

Checking cv_icinga2_6 [VERBOSE] Desired version latest found in CCV [VERBOSE] Found 2.0 as the 'latest' version ...`