Hammer and API calls for importing puppet classes

Hi all,

I am working on some scripts for automating the deployment/import of our
puppet modules for our CI pipeline.

I am currently looking into both the hammercli as well as making a call to
the api (depending on what application could be doing this).

From both avenues, I am unable to execute the import of puppet classes.

From hammercli:
hammer proxy import_classes --id=1

Started POST "/api/smart_proxies/1/import_puppetclasses" for X.X.X.X at
2014-01-01 21:47:39 -0500

Processing by Api::V1::HomeController#route_error as JSON

Parameters: {"dryrun"=>nil,
"other"=>"smart_proxies/1/import_puppetclasses", "home"=>{"dryrun"=>nil}}

Authorized user admin(Admin User)

Rendered api/v1/errors/route_error.json.rabl (0.4ms)

Completed 404 Not Found in 22ms (Views: 1.1ms | ActiveRecord: 12.2ms)

From API script:

curl -s -H "Accept:application/json" \

-k -u $USER:$PASS \

$FOREMAN_URL/smart_proxies/1/import_puppetclasses | prettify_json.rb

Same result as the call from hammercli (which would make sense since it is
the same POST :wink:

I have verified the that proxy id maps to 1 for my puppet server. From the
web interface, I can manually import just fine.

I have also noticed however, that running the following does not pick up
changes anymore even when they do exist:

/usr/sbin/foreman-rake puppet:import:puppet_classes[batch]
RAILS_ENV=production

Any insights would be appreciated!

Thanks!

Chuck

> Hi all,
>
> I am working on some scripts for automating the deployment/import of our
> puppet modules for our CI pipeline.
>
> I am currently looking into both the hammercli as well as making a call to
> the api (depending on what application could be doing this).
>
> From both avenues, I am unable to execute the import of puppet classes.
>
> From hammercli:
> hammer proxy import_classes --id=1
>
> Started POST "/api/smart_proxies/1/import_puppetclasses" for X.X.X.X at
> 2014-01-01 21:47:39 -0500
>
> Processing by Api::V1::HomeController#route_error as JSON
>
> Parameters: {"dryrun"=>nil,
> "other"=>"smart_proxies/1/import_puppetclasses", "home"=>{"dryrun"=>nil}}
>
> Authorized user admin(Admin User)
>
> Rendered api/v1/errors/route_error.json.rabl (0.4ms)
>
> Completed 404 Not Found in 22ms (Views: 1.1ms | ActiveRecord: 12.2ms)
>
>
> From API script:
>
> curl -s -H "Accept:application/json"
>
> -k -u $USER:$PASS
>
> $FOREMAN_URL/smart_proxies/1/import_puppetclasses | prettify_json.rb
>
> Same result as the call from hammercli (which would make sense since it is
> the same POST :wink:
>
> I have verified the that proxy id maps to 1 for my puppet server. From
> the web interface, I can manually import just fine.
>
> I have also noticed however, that running the following does not pick up
> changes anymore even when they do exist:
>
> /usr/sbin/foreman-rake puppet:import:puppet_classes[batch]
> RAILS_ENV=production
>
>
> Any insights would be appreciated!
>

which version of foreman are you running? afair, this was introduced only
in the 1.4x series, see Feature #3693: API v2 - accept GET json format of object in PUT/POST requests to add/remove has_many associations - Foreman

Ohad

··· On Thu, Jan 2, 2014 at 4:55 AM, wrote:

Thanks!

Chuck


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