Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

merge changes for 6.3 in master. #52

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

merge changes for 6.3 in master. #52

wants to merge 7 commits into from

Conversation

gearboxscott
Copy link

make the changes necessary for cvmanager to work with Satellite version 6.3.

@mccun934
Copy link

@evgeni talked to Scott about getting master updated to 6.3 support.

We should probably branch master as it is now to a new satellite-6.2 branch so users can clone depending on the version they want. I'll let you review the changes since I'm not familiar with this code.

Copy link
Contributor

@Rocco83 Rocco83 left a comment

Choose a reason for hiding this comment

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

I can be blind, but the code is duplicated from row 25 on.

@Rocco83
Copy link
Contributor

Rocco83 commented Apr 27, 2018

@mccun934 @evgeni I personally think that we need to not let go PR before moving to 6.3.
My very brief review is above. The code seems to me duplicated in the main file.
@gearboxscott am i correct? I have deleted from 518 on, diff on the current master, and seems to me at least a proper diff.
You have kept a couple of # end loop which i think are in @evgeni style. But up to him.

I would suggest a review of the PR anyway.

@gearboxscott
Copy link
Author

@mccun934 @Rocco83

some how when I uploaded from my copy, it duplicated. Let me re-upload it again and fix the issue.

Scott

cvmanager Outdated
@@ -54,7 +47,7 @@ require 'time'
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{opts.program_name} ACTION [options]"
opts.version = "0.1"

Copy link
Contributor

Choose a reason for hiding this comment

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

Useless white space

@gearboxscott
Copy link
Author

@mccun934 @Rocco83

I uploaded a new copy of the code to my branch, can you see it?

@gearboxscott
Copy link
Author

@mccun934 @Rocco83

I didn't realize that it did that because I didn't look at it when I uploaded it to github.com. Should be better now.

Scott

end

was_updated = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Why always was_updated = true?

Copy link
Contributor

Choose a reason for hiding this comment

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

The following is taken as example from a CCV API call

content_view_components	
  0	
    latest	false <-- this is true if latest is selected.

Given that, if latest exists and is true, then we can proceed.
Also, I think that the best would be to check anyway if we have the latest version or not of a CV in a CCV.
The reason is, we are going to publish anyway always a new CCV for nothing.

The whole idea of cvmanager is to do actions only if necessary, i think.

My 2 cents,

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, latest should be a special case, and given the API tells us about it, we can handle it properly, instead of removing the code that handles explicit versions.

That's the only 6.3 change, right?

# do the update
was_updated = true
end
# end loop
Copy link
Contributor

Choose a reason for hiding this comment

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

Stylistic approach, i think to be agreed with @evgeni

gem install apipie
```

This version will no longer work with Satellite 6.2 or less.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not to make an API call to check if latest is supported or not?
So the code may be backward compatible.

Copy link
Author

Choose a reason for hiding this comment

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

@Rocco83, when @mccun934 told me to merge the changes into the current code for 6.3 and they can download a prior release for 6.2 or less. We can add this functionality but then we need to add in the update section of the code a branch for 6.2 or less. @mccun934 do you me to do that or have them download a prior release?

Copy link
Member

Choose a reason for hiding this comment

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

How big is the diff between 6.2 and 6.3 compat? I'd prefer to remain 6.2 compatibility, but if it's too much of a burden, I'd tag a last 6.2 compatible release and carry on with the modern code.

@@ -250,11 +250,11 @@ def update()
# either the version for the component in this CCV is set
# or it is set globally
# never touch non-mentioned components
if @yaml[:ccv].is_a?(Hash) and @yaml[:ccv].has_key?(ccv['label']) and @yaml[:ccv][ccv['label']].has_key?(component['content_view']['label'])
desired_version = @yaml[:ccv][ccv['label']][component['content_view']['label']]
if @yaml[:ccv].is_a?(Hash) and @yaml[:ccv].has_key?(ccv['label']) and @yaml[:ccv][ccv['label']].has_key?(component['content_view']['name'])
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to rely on name?
This is against #50

Copy link
Author

Choose a reason for hiding this comment

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

@Rocco83 , keep in mind I'm not the originator of the code, my sole purpose of updated was to fix it for 6.3 so my current customer using the code didn't have their periodic based update process for server calling this from cron breaking. I don't agree with the all the logic here because I would like had a method of chaining a publish+update+promote be in one step. I just wanted get it working for 6.3 customers. If we want to go back a visit the logic and rewrite a good portion of then let do that in a different pull request. Or have completely missed the point of fixing this and we need to rewrite some of the flow?

Copy link
Contributor

Choose a reason for hiding this comment

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

I do not understand the point, why is a change needed here?
Sorry but i am not getting that.

Copy link
Author

Choose a reason for hiding this comment

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

@Rocco83 when you run the existing code as it was on a 6.3, the composite content view is marked latest, meaning as you know, you don't have to visit the composite view and update the version of the content views within it. You just have to push. The code, was looking for, something to update and didn't know how to recognize that it's already set to latest and it just needs to be published. the update just run and spews out the version but it doesn't publish, it exits. Try it out, run it on a sat 6.2 and then again on 6.3. 6.2 will change, 6.3 will just exit.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am just referring to this portion of code. Why asking for name instead of label would do the trick?
Am I wrong if i say that what would do the job is in line 274?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, labels should be labels. IMHO. Need to re-run that code with latest katello, tho.

changed ruby to tfm-ruby
cvmanager Outdated
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
#!/usr/bin/env tfm-ruby
Copy link
Member

Choose a reason for hiding this comment

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

I must admit I'd prefer to keep the tfm SCL away from the shebang. There are 1000 ways to get the script working, and tfm-ruby is just one of them.

For example, this also works (and that's how I run cvmanager on our Jenkins):

bundle install
bundle exec ruby ./cvmanager …

@@ -1,3 +1,17 @@
# Satellite 6.3 Update

Satellite 6.3 no longer provide apipie via the repositories. To use this utility, install apipie.
Copy link
Member

Choose a reason for hiding this comment

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

Not completely true, we just don't provide apipie-bindings for the system ruby.

I think we should document the various ways users can run it, and let them decide:

  1. the most Ruby way would be bundle:
bundle install
bundle exec ruby ./cvmanager …
  1. scl enable tfm -- ./cvmanager works on any production install of Katello/Satellite
  2. gem install apipie-bindings followed by a ./cvmanager also works, but is the most unclean one, imho

gem install apipie
```

This version will no longer work with Satellite 6.2 or less.
Copy link
Member

Choose a reason for hiding this comment

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

How big is the diff between 6.2 and 6.3 compat? I'd prefer to remain 6.2 compatibility, but if it's too much of a burden, I'd tag a last 6.2 compatible release and carry on with the modern code.


# Origin

This was forked from katello-cvmanger https://github.com/RedHatSatellite/katello-cvmanager and updated to work with Satellite 6.3.
Copy link
Member

Choose a reason for hiding this comment

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

This is not a fork, it's a tribute, erm, PR ;)

end

was_updated = true
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, latest should be a special case, and given the API tells us about it, we can handle it properly, instead of removing the code that handles explicit versions.

That's the only 6.3 change, right?

@@ -250,11 +250,11 @@ def update()
# either the version for the component in this CCV is set
# or it is set globally
# never touch non-mentioned components
if @yaml[:ccv].is_a?(Hash) and @yaml[:ccv].has_key?(ccv['label']) and @yaml[:ccv][ccv['label']].has_key?(component['content_view']['label'])
desired_version = @yaml[:ccv][ccv['label']][component['content_view']['label']]
if @yaml[:ccv].is_a?(Hash) and @yaml[:ccv].has_key?(ccv['label']) and @yaml[:ccv][ccv['label']].has_key?(component['content_view']['name'])
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, labels should be labels. IMHO. Need to re-run that code with latest katello, tho.

removed the use of tfm-ruby
Rocco83 added a commit to Rocco83/katello-cvmanager that referenced this pull request May 3, 2018
@Rocco83
Copy link
Contributor

Rocco83 commented May 3, 2018

I have pushed #53 as alternative. @gearboxscott feel free to post your comment!
Code is anyway not heavily reviewed. A test would be more then appreciated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants