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 #29993 - Drop Puppetrun #7719

Merged
merged 1 commit into from Jul 18, 2020

Conversation

domitea
Copy link
Contributor

@domitea domitea commented Jun 3, 2020

Removing puppetrun from core

@theforeman-bot
Copy link
Member

Issues: #29993

@ekohl
Copy link
Member

ekohl commented Jun 3, 2020

Not looking at the code, I think the descriptions of this and the issue are way too minimal. As an upgrading user this is not very useful. Normally we try to give some background about the feature, why it's being removed and what the alternatives are. It's also good refer to discussion that has happened, like RFCs.

Another thing to consider is that right now this feature hasn't been deprecated. Luckily we're still in the RC phase of 2.1 but at the very least the 2.1 manual needs a release note about this.

Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

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

I'd agree with Ewoud we should keep the API for few versions.

@ezr-ondrej
Copy link
Member

@domitea ? This would be nice to get in, what is the status here? :)

Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

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

Why have you decided to keep PUPPET_MULTIPLE_ACTIONS ?
I believe now it should be == to the MULTIPLE_EDIT_ACTIONS and thus we can use that instead.

else
super
when 'puppetrun'
:puppetrun
Copy link
Member

Choose a reason for hiding this comment

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

haven't we dropped the permission?

I believe we can prepend_before_action and render there directly. Also, we can add deprecations for the apidocs.

Take a look at https://github.com/theforeman/foreman/pull/7800/files#diff-36882131819ddf97a1e444b073996328R5
I believe we can do the same here and keep just empty puppetrun method with the prepended filter, that will render the status.

app/controllers/api/v2/puppet_hosts_controller.rb Outdated Show resolved Hide resolved
@ezr-ondrej
Copy link
Member

This needs rebase

Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

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

Few point just to make it bit more tidy.
Additionaly do we have at least a redmine ticket to remove the SmartProxy endpoint for this?

@@ -4,23 +4,23 @@ class PuppetHostsController < V2::BaseController
include Api::Version2
include HostsControllerExtension

prepend_before_action :fail_and_inform_about_plugin

check_permissions_for ['puppetrun']
Copy link
Member

Choose a reason for hiding this comment

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

This can be dropped as well now :)

param :id, :identifier_dottable, :required => true

def puppetrun
return deny_access unless Setting[:puppetrun]
process_response @host.puppetrun!
end

def action_permission
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to keep the method now, right?

@@ -4,23 +4,23 @@ class PuppetHostsController < V2::BaseController
include Api::Version2
include HostsControllerExtension

prepend_before_action :fail_and_inform_about_plugin

Copy link
Member

Choose a reason for hiding this comment

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

Look at this block: https://github.com/theforeman/foreman/pull/7800/files#diff-36882131819ddf97a1e444b073996328R7-R10
It would mark the resource as deprecated in /apidoc. I think we can use it here as well.
I'm not sure if it wouldn't deprecate the enpoints added by HostsControllerExtensions so it needs to get tested. I'd be ok if we do not have it if that turns out to be too much of strugle. If it works though, it adds visibility to the deprecation.

Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

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

Thanks @domitea, looks good now 👍
Thanks for the ticket, for reference: RM#30429

@ezr-ondrej
Copy link
Member

[test katello] doesn't seem related, but it's quite a lot of failures

@ezr-ondrej
Copy link
Member

[test katello]

scope "(:apiv)", :module => :v2, :defaults => {:apiv => 'v2'}, :apiv => /v2/, :constraints => ApiConstraints.new(:version => 2, :default => true) do
constraints(:id => /[^\/]+/) do
resources :hosts, :except => [:new, :edit] do
put :puppetrun, :on => :member, :to => 'puppet_hosts#puppetrun'
Copy link
Member

Choose a reason for hiding this comment

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

Oh, I've missed this.
This needs to stay, otherwise the deprecated API endpoint will not work.

Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

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

Please bring back the api endpoint file, otherwise the endpoint is good as dead (404) and noone will see the informative 501 error :)

@domitea
Copy link
Contributor Author

domitea commented Jul 17, 2020

@ezr-ondrej File returned, hope It's ready for merge

Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

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

We need to skip the endpoint from access_permissions_test

test/unit/foreman/access_permissions_test.rb Outdated Show resolved Hide resolved
Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

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

Works for me 👍

@ezr-ondrej ezr-ondrej merged commit 2f2e926 into theforeman:develop Jul 18, 2020
@ezr-ondrej
Copy link
Member

Thanks @domitea ! 👍

@ekohl
Copy link
Member

ekohl commented Sep 4, 2020

This needs to be reflected in the 2.2 and nightly manual. Section 3.5.2 still refers to the puppetrun setting.

@zeha
Copy link

zeha commented Nov 6, 2020

Coming from an over-time upgraded install, the migration (2.2.0) here fails with:

== 20200602155700 DropPuppetRun: migrating ====================================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Setting::Puppet is marked as readonly

FTR, DB contents for this setting:

foreman=# select * from settings where name = 'puppetrun';
-[ RECORD 1 ]-+---------------------------
id            | 22
name          | puppetrun
value         |
description   | Enable puppetrun support
category      | Setting::Puppet
settings_type | boolean
default       | --- false
created_at    | 2020-08-24 19:22:15.624772
updated_at    | 2020-08-24 19:22:15.624772
full_name     | Puppetrun
encrypted     | f

@ekohl
Copy link
Member

ekohl commented Nov 6, 2020

@zeha the problem is that if puppetrun is in settings.yaml that the migration fails. #8125 should fix that but the workaround is to drop puppetrun from settings.yaml before running the migration.

@zeha
Copy link

zeha commented Nov 6, 2020

@zeha the problem is that if puppetrun is in settings.yaml that the migration fails [...]

thanks!

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