-
Notifications
You must be signed in to change notification settings - Fork 31
merge changes for 6.3 in master. #52
base: master
Are you sure you want to change the base?
Conversation
…g composite views with the latest versions of content views.
@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. |
There was a problem hiding this 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.
@mccun934 @evgeni I personally think that we need to not let go PR before moving to 6.3. I would suggest a review of the PR anyway. |
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" | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless white space
end | ||
|
||
was_updated = true |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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,
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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']) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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:
- the most Ruby way would be bundle:
bundle install
bundle exec ruby ./cvmanager …
scl enable tfm -- ./cvmanager
works on any production install of Katello/Satellitegem 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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']) |
There was a problem hiding this comment.
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
…tellite#43 This fix override also PR RedHatSatellite#52, making it obsolete.
I have pushed #53 as alternative. @gearboxscott feel free to post your comment! |
make the changes necessary for cvmanager to work with Satellite version 6.3.