Need to import only one environment from puppet master to foreman

Hi Dev Team,

In foreman import puppet classes API is taking very long time(more than 5
mins) even if i pass one environment. I checked the code and foreman is
fetching all environment and puppet classes of each environment and
checking in database and storing changes in db.

Example API:

curl -u admin:changeme -H 'accept:application/json' -k
'https://foreman-dev.com/api/v2/smart_proxies/1/environments/1/import_puppetclasses.json'
-d '' -X POST

But when we pass environment in the URL, is it be good idea to fetch only
that environment and the puppet classes of that environment from puppet
master and update in database?

In the file
app/controllers/concerns/api/import_puppetclasses_common_controller.rb line
number 51 currently it has

opts = { :url => @smart_proxy.url }

Can it be changed to

opts = @environment ? { :url => @smart_proxy.url, :env =>
@environment.name } : { :url => @smart_proxy.url }

Above line will fetch only one environment from puppet master and store in
db.

Will you please check this and integrate in foreman ?

Regards,
Nagarjuna

Hi Nagarjuna,

Is Bug #6856: Importing single environments not faster than importing all - Foreman the same issue? It seems
related to your problem.

Best,

··· On Mon, Sep 22, 2014 at 11:56 AM, Nagarjuna Rachaneni < nn.nagarjuna@gmail.com> wrote:

Hi Dev Team,

In foreman import puppet classes API is taking very long time(more than 5
mins) even if i pass one environment. I checked the code and foreman is
fetching all environment and puppet classes of each environment and
checking in database and storing changes in db.

Example API:

curl -u admin:changeme -H ‘accept:application/json’ -k ‘
https://foreman-dev.com/api/v2/smart_proxies/1/environments/1/import_puppetclasses.json
-d ‘’ -X POST

But when we pass environment in the URL, is it be good idea to fetch only
that environment and the puppet classes of that environment from puppet
master and update in database?

In the file
app/controllers/concerns/api/import_puppetclasses_common_controller.rb line
number 51 currently it has

opts = { :url => @smart_proxy.url }

Can it be changed to

opts = @environment ? { :url => @smart_proxy.url, :env => @
environment.name } : { :url => @smart_proxy.url }

Above line will fetch only one environment from puppet master and store in
db.

Will you please check this and integrate in foreman ?

Regards,
Nagarjuna


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Daniel Lobato

@elobatoss
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30

Yes it is same issue. So are you looking into it ?

Regards,
Nagarjuna

··· On Monday, 22 September 2014 15:26:42 UTC+5:30, Nagarjuna Rachaneni wrote: > > Hi Dev Team, > > In foreman import puppet classes API is taking very long time(more than 5 > mins) even if i pass one environment. I checked the code and foreman is > fetching all environment and puppet classes of each environment and > checking in database and storing changes in db. > > Example API: > > curl -u admin:changeme -H 'accept:application/json' -k ' > https://foreman-dev.com/api/v2/smart_proxies/1/environments/1/import_puppetclasses.json' > -d '' -X POST > > But when we pass environment in the URL, is it be good idea to fetch only > that environment and the puppet classes of that environment from puppet > master and update in database? > > In the file > app/controllers/concerns/api/import_puppetclasses_common_controller.rb line > number 51 currently it has > > opts = { :url => @smart_proxy.url } > > Can it be changed to > > opts = @environment ? { :url => @smart_proxy.url, :env => @ > environment.name } : { :url => @smart_proxy.url } > > Above line will fetch only one environment from puppet master and store in > db. > > Will you please check this and integrate in foreman ? > > > Regards, > Nagarjuna > > > > > > > >

Nagarjuna,

Can you check if this patch https://github.com/theforeman/foreman/pull/1789 works for you.

Thanks,

Joseph
Red Hat Engineering

··· ----- Original Message ----- > From: "Nagarjuna Rachaneni" > To: foreman-dev@googlegroups.com > Sent: Tuesday, September 23, 2014 7:35:26 AM > Subject: [foreman-dev] Re: Need to import only one environment from puppet master to foreman > > Yes it is same issue. So are you looking into it ? > > Regards, > Nagarjuna > > On Monday, 22 September 2014 15:26:42 UTC+5:30, Nagarjuna Rachaneni wrote: > > > > Hi Dev Team, > > > > In foreman import puppet classes API is taking very long time(more than 5 > > mins) even if i pass one environment. I checked the code and foreman is > > fetching all environment and puppet classes of each environment and > > checking in database and storing changes in db. > > > > Example API: > > > > curl -u admin:changeme -H 'accept:application/json' -k ' > > https://foreman-dev.com/api/v2/smart_proxies/1/environments/1/import_puppetclasses.json' > > -d '' -X POST > > > > But when we pass environment in the URL, is it be good idea to fetch only > > that environment and the puppet classes of that environment from puppet > > master and update in database? > > > > In the file > > app/controllers/concerns/api/import_puppetclasses_common_controller.rb line > > number 51 currently it has > > > > opts = { :url => @smart_proxy.url } > > > > Can it be changed to > > > > opts = @environment ? { :url => @smart_proxy.url, :env => @ > > environment.name } : { :url => @smart_proxy.url } > > > > Above line will fetch only one environment from puppet master and store in > > db. > > > > Will you please check this and integrate in foreman ? > > > > > > Regards, > > Nagarjuna > > > > > > > > > > > > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "foreman-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to foreman-dev+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. >

Hi Joseph,

This patch fixed my problem. Thank you.

Regards,
Nagarjuna

··· On Tuesday, 23 September 2014 12:59:40 UTC+5:30, Joseph Magen wrote: > > Nagarjuna, > > Can you check if this patch > https://github.com/theforeman/foreman/pull/1789 works for you. > > Thanks, > > Joseph > Red Hat Engineering > > > > ----- Original Message ----- > > From: "Nagarjuna Rachaneni" <nn.nag...@gmail.com > > > To: forem...@googlegroups.com > > Sent: Tuesday, September 23, 2014 7:35:26 AM > > Subject: [foreman-dev] Re: Need to import only one environment from > puppet master to foreman > > > > Yes it is same issue. So are you looking into it ? > > > > Regards, > > Nagarjuna > > > > On Monday, 22 September 2014 15:26:42 UTC+5:30, Nagarjuna Rachaneni > wrote: > > > > > > Hi Dev Team, > > > > > > In foreman import puppet classes API is taking very long time(more > than 5 > > > mins) even if i pass one environment. I checked the code and foreman > is > > > fetching all environment and puppet classes of each environment and > > > checking in database and storing changes in db. > > > > > > Example API: > > > > > > curl -u admin:changeme -H 'accept:application/json' -k ' > > > > https://foreman-dev.com/api/v2/smart_proxies/1/environments/1/import_puppetclasses.json' > > > > -d '' -X POST > > > > > > But when we pass environment in the URL, is it be good idea to fetch > only > > > that environment and the puppet classes of that environment from > puppet > > > master and update in database? > > > > > > In the file > > > app/controllers/concerns/api/import_puppetclasses_common_controller.rb > line > > > number 51 currently it has > > > > > > opts = { :url => @smart_proxy.url } > > > > > > Can it be changed to > > > > > > opts = @environment ? { :url => @smart_proxy.url, :env => @ > > > environment.name } : { :url => @smart_proxy.url } > > > > > > Above line will fetch only one environment from puppet master and > store in > > > db. > > > > > > Will you please check this and integrate in foreman ? > > > > > > > > > Regards, > > > Nagarjuna > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "foreman-dev" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to foreman-dev...@googlegroups.com . > > For more options, visit https://groups.google.com/d/optout. > > >