Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #27838 - Refactor cvv export to allow for default cv #697

Merged
merged 1 commit into from Sep 12, 2019
Merged

Fixes #27838 - Refactor cvv export to allow for default cv #697

merged 1 commit into from Sep 12, 2019

Conversation

chris1984
Copy link
Member

@chris1984 chris1984 commented Sep 11, 2019

This PR accomplishes the following items:

  • Allows the default organization view to be exported and imported
  • Clean of up cv_import_export_helper.rb by refactoring methods to allow for removing unsupported content types and repos not set to immediate and providing a message to the user of what did not get included in the export.
  • Modified the import of a default content view so that we do not try to publish the default view since it is immutable.
  • With the refactor of methods and fewer loops/API calls back to the server I did notice a slight increase in the speed of the export on a production box.

This is the result of my testing:

My export setup:

[root@importtest ~]# hammer repository list
---|----------------------------------------------------------------------------------|------------------------------------------------|--------------|---------------------------------------------------------------------------------
ID | NAME                                                                             | PRODUCT                                        | CONTENT TYPE | URL                                                                             
---|----------------------------------------------------------------------------------|------------------------------------------------|--------------|---------------------------------------------------------------------------------
1  | dotNET on RHEL RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server         | dotNET on RHEL (for RHEL Server)               | yum          | https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/dotnet/1/os    
7  | Puppet                                                                           | Custom-Stuff                                   | puppet       |                                                                                 
3  | Red Hat Ansible Engine 2.8 RPMs for Red Hat Enterprise Linux 7 Server x86_64     | Red Hat Ansible Engine                         | yum          | https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/ansible/2.8/os 
2  | Red Hat Satellite Maintenance 6 for RHEL 7 Server RPMs x86_64                    | Red Hat Enterprise Linux Server                | yum          | https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/sat-maintena...
4  | Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_6... | Red Hat Software Collections (for RHEL Server) | yum          | https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/rhscl/1/os     
6  | Small                                                                            | Custom-Stuff                                   | yum          | https://mmccune.fedorapeople.org/repos/small/                                   
5  | zoo-demand                                                                       | Custom-Stuff                                   | yum          | https://repos.fedorapeople.org/pulp/pulp/demo_repos/zoo/                        
---|----------------------------------------------------------------------------------|------------------------------------------------|--------------|---------------------------------------------------------------------------------

[root@importtest ~]# hammer content-view list
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
1               | Default Organization View | Default_Organization_View |           | 2019/09/11 20:19:53 |               
2               | Mixed                     | Mixed                     |           | 2019/09/12 00:50:48 | 1, 6, 5       
----------------|---------------------------|---------------------------|-----------|---------------------|---------------

We can see the import run correctly:

[.....................................................................................................................................................................................] [100%]
New packages: 285 (2.96 GB).
"Content view imported."

Here we can see the publish date updated to the date of my system showing the import went through:

[root@importtest ~]# hammer content-view info --id 1
ID:                           1
Name:                         Default Organization View
Label:                        Default_Organization_View
Composite:                    false
Description:                  
Content Host Count:           0
Force Puppet:                 false
Solve Dependencies:           false
Organization:                 Default Organization
Yum Repositories:             
Lifecycle Environments:       
 1) ID:   1
    Name: Library
Versions:                     
 1) ID:        1
    Version:   1.0
    Published: 2019/09/11 20:19:53
		
[root@importtest ~]# date
Thu Sep 11 20:19:55 2019

Here we can see the default and the custom content view I made showing published with my system time and the Mixes content view missing repo 6 which was set to on-demand, to show that the filtering is working during export:

---------------|---------------------------|---------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
1               | Default Organization View | Default_Organization_View |           | 2019/09/11 20:19:53 |               
2               | Mixed                     | Mixed                     |           | 2019/09/11 20:30:11 | 1, 5          
----------------|---------------------------|---------------------------|-----------|---------------------|---------------

Here is a screenshot showing the repos synced correctly for the default view import:

https://nimb.ws/bx529o

@Katello Katello deleted a comment from theforeman-bot Sep 11, 2019
@chris1984 chris1984 changed the title updated default import Fixes #27838 - Refactor cvv export to allow for default content view Sep 11, 2019
@Katello Katello deleted a comment from theforeman-bot Sep 11, 2019
@chris1984 chris1984 changed the title Fixes #27838 - Refactor cvv export to allow for default content view Fixes #27838 - Refactor cvv export to allow for default cv Sep 11, 2019
@chris1984 chris1984 marked this pull request as ready for review September 12, 2019 02:21
@chris1984
Copy link
Member Author

@jturel updated

Copy link
Member

@akofink akofink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments inline, mostly about removing the tests.

Copy link
Member

@akofink akofink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no concerns that are blocking this PR. :shipit:

@jturel
Copy link
Member

jturel commented Sep 12, 2019

This is working great. I made one observation:

After successful import of the default view into a fresh org the output from hammer says "No new packages." but I can see all of the packages were imported. If it's not something we introduced here let's fix it later, but worth being aware of.

Edit: just spoke with @chris1984 and explained why, so I'm good

Copy link
Member

@jturel jturel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK!

@chris1984
Copy link
Member Author

Thanks All 🍻 :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants