Project

General

Profile

Feature #32504

Allow importing only environments (not classes) using the Foreman proxy

Added by Nacho Barrientos over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Foreman 1.24 removed (https://github.com/theforeman/foreman/pull/7080/files) some Rake tasks that allowed to import environments and/or classes using the Foreman proxy. From the changelog (https://theforeman.org/manuals/1.24/#Releasenotesfor1.24):

Rake tasks puppet:import:puppet_classes and puppet:import:environments_only have been removed. These actions should be done by using the matching UI or API actions.

As mentioned in the release notes, the task was partly replaced via an API call of this sort:

POST api/smart_proxies/$smart_proxy_id/import_puppetclasses

On each invocation, this operation does several calls to the Foreman proxy, on:

1) GET puppet/environments
2) GET puppet/environments/$environment_name/classes

(1) seems to be performed several times per update and (2) is executed once per environment. These are heavy operations that take time which, in an environment like ours where importing classes is not desired and we have a rather big environment and class sets, significantly increments the time it takes to refresh the environment list. Actually, we only need a single call to (1) per update in our case.

Would you consider adding a setting to only import environments kind of restoring the functionality that was left behind when the Rake task was removed?

We have a local patch applied that I'm attaching that kind of implements this approach in case it could serve as a source of inspiration. Of course, this behavior would have to be put behind a setting.

noclass.patch noclass.patch 1.98 KB Nacho Barrientos, 05/04/2021 01:32 PM

Also available in: Atom PDF