Foreman''s report agent, for some reason, doesn''t update as
many of the
Foreman DB fields as one might wish. I submitted a patch on this, but as
Mark pointed out, the approved way to do this is to run a rake periodically
to re-import all of the reports and/or classes.
If you are interested in hacking it for yourself, you should look at
app/models/report.rb. You''ll specifically be looking at
self.import(yaml).
Here is the meat of my patch:
host.environment
Environment.find_or_create_by_name(host.fv(:environment))
host.hostgroup
Hostgroup.find_or_create_by_name(host.fv(:cprt_globalzone))
host.architecture
Architecture.find_or_create_by_name(host.fv(:hardwareisa))
val = host.fv(:productname)
val = host.fv(:virtual) if val == nil
host.model = Model.find_or_create_by_name(val)
major, minor = host.fv(:operatingsystemrelease).split(".",2)
v = Operatingsystem.first(:conditions => "name
\"#{host.fv(:operatingsystem)}\" and major = \"#{major}\"
and minor \"#{minor}\"")
if v
host.os = v
else
host.os = Operatingsystem.create({:name =>
host.fv(:operatingsystem),
:major => major,
:minor => minor})
end
host.puppetclasses =
host.fv(:cprt_classes).split('','').map() do |c|
Puppetclass.find_or_create_by_name(c)
end
On Mon, Dec 20, 2010 at 5:05 AM, Mark Stanislav
<mark.stanislav@gmail.com>wrote:
> You need to run the rake again. Setup a cronjob to execute it every so
> often if you need new hosts regularly (e.g. Auto scaling)
>
> -Mark
>
>
>
> On Dec 20, 2010, at 6:58 AM, walexey <walexey@gmail.com> wrote:
>
> > Hello!
> > I try to use foreman. It''s successfuly import current nodes
from
> > puppet storeconfig. Nodes hostname stored in short form, without
> > domain.
> > After that, i run puppet on newly created additional 5 nodes. They
> > shows in foreman with full fqdn. Os, environment, architecture for
> > this nodes not shown.
> > How can i fix this issue?
> >
> > --
> > You received this message because you are subscribed to the Google
Groups
> "Puppet Users" group.
> > To post to this group, send email to puppet-users@googlegroups.com.
> > To unsubscribe from this group, send email to
>
puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com>
> .
> > For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
>
puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.