Issue #11830 has been updated by Daniel Pittman.

Status changed from Needs More Information to Accepted

The issue here is that you can't set the environment using the REST API to 
trigger an agent run.  Inspecting the code it looks like, indeed, that data is 
discarded in the code - we don't pass it from the request to the code that 
triggers the run.

I have accepted this, but it isn't likely to be super-high priority for the 
platform team.  We generally recommend, eg, mcollective as a better alternative 
to this REST API, in part because it works, and is more flexible, than this API 
is.

It is a genuine bug, though, and we absolutely will keep it on the path to fix 
eventually.  We would absolutely accept a patch to fix it sooner, though.
----------------------------------------
Bug #11830: API REST doesn't interpret environment
https://projects.puppetlabs.com/issues/11830

Author: Jonas Rockenbauer
Status: Accepted
Priority: Normal
Assignee: Jonas Rockenbauer
Category: API
Target version: 
Affected Puppet version: 2.7.9
Keywords: API, REST, environment
Branch: 


I have two environment **devone** and **devtwo** but when i try a curl exec 
with this class
<pre>
class validation_client {
notify { "variable $environment": }
}
</pre>

The curl command **curl -k -X PUT -H 'Content-Type: text/pson' -d '{}' 
https://CTLVS008:8139/devone/run/no_key** return
<pre>
--- !ruby/object:Puppet::Run
  options:
    !ruby/sym report: !ruby/object:Puppet::Transaction::Report
      configuration_version: 1326105955
      host: ctlvs008.dip.fr
      kind: apply
      logs:
        - !ruby/object:Puppet::Util::Log
          level: !ruby/sym notice
          message: &id001 variable production
          source: Puppet
          tags:
            - notice
          time: 2012-01-09 11:45:55.505003 +01:00
        - !ruby/object:Puppet::Util::Log
          file: &id003 
/var/lib/puppet/modules/TEST/manifests/classes/validation_client.pp
          level: !ruby/sym notice
          line: 3
          message: &id002 defined 'message' as 'variable production'
          source: "/Stage[main]/Validation_client/Notify[variable 
production]/message"
          tags:
            - notice
            - notify
            - class
            - validation_client
            - node
            - ctlvs008
          time: 2012-01-09 11:45:55.505616 +01:00
        - !ruby/object:Puppet::Util::Log
          level: !ruby/sym notice
          message: Finished catalog run in 0.06 seconds
          source: Puppet
          tags:
            - notice
          time: 2012-01-09 11:45:55.529133 +01:00
      metrics:
        time: !ruby/object:Puppet::Util::Metric
          label: Time
          name: time
          values:
            - - total
              - Total
              - 0.187576945953369
            - - config_retrieval
              - Config retrieval
              - 0.184896945953369
            - - filebucket
              - Filebucket
              - 0.000379
            - - notify
              - Notify
              - 0.002301
        resources: !ruby/object:Puppet::Util::Metric
          label: Resources
          name: resources
          values:
            - - out_of_sync
              - Out of sync
              - 1
            - - changed
              - Changed
              - 1
            - - total
              - Total
              - 8
            - - skipped
              - Skipped
              - 6
        events: !ruby/object:Puppet::Util::Metric
          label: Events
          name: events
          values:
            - - total
              - Total
              - 1
            - - success
              - Success
              - 1
        changes: !ruby/object:Puppet::Util::Metric
          label: Changes
          name: changes
          values:
            - - total
              - Total
              - 1
      puppet_version: 2.7.9
      report_format: 2
      resource_statuses:
        "Schedule[weekly]": !ruby/object:Puppet::Resource::Status
          change_count: 0
          changed: false
          events: []
          failed: false
          file:
          line:
          out_of_sync: false
          out_of_sync_count: 0
          resource: "Schedule[weekly]"
          resource_type: Schedule
          skipped: true
          tags:
            - schedule
            - weekly
          time: 2012-01-09 11:45:55.513049 +01:00
          title: weekly
        "Filebucket[puppet]": !ruby/object:Puppet::Resource::Status
          change_count: 0
          changed: false
          evaluation_time: 0.000379
          events: []
          failed: false
          file:
          line:
          out_of_sync: false
          out_of_sync_count: 0
          resource: "Filebucket[puppet]"
          resource_type: Filebucket
          skipped: false
          tags:
            - filebucket
            - puppet
          time: 2012-01-09 11:45:55.512297 +01:00
          title: puppet
        "Notify[variable production]": !ruby/object:Puppet::Resource::Status
          change_count: 1
          changed: true
          evaluation_time: 0.002301
          events:
            - !ruby/object:Puppet::Transaction::Event
              audited: false
              desired_value: *id001
              historical_value:
              message: *id002
              name: !ruby/sym message_changed
              previous_value: !ruby/sym absent
              property: message
              status: success
              time: 2012-01-09 11:45:55.504664 +01:00
          failed: false
          file: *id003
          line: 3
          out_of_sync: true
          out_of_sync_count: 1
          resource: "Notify[variable production]"
          resource_type: Notify
          skipped: false
          tags:
            - notify
            - class
            - validation_client
            - node
            - ctlvs008
          time: 2012-01-09 11:45:55.503987 +01:00
          title: variable production
        "Schedule[hourly]": !ruby/object:Puppet::Resource::Status
          change_count: 0
          changed: false
          events: []
          failed: false
          file:
          line:
          out_of_sync: false
          out_of_sync_count: 0
          resource: "Schedule[hourly]"
          resource_type: Schedule
          skipped: true
          tags:
            - schedule
            - hourly
          time: 2012-01-09 11:45:55.490977 +01:00
          title: hourly
        "Schedule[daily]": !ruby/object:Puppet::Resource::Status
          change_count: 0
          changed: false
          events: []
          failed: false
          file:
          line:
          out_of_sync: false
          out_of_sync_count: 0
          resource: "Schedule[daily]"
          resource_type: Schedule
          skipped: true
          tags:
            - schedule
            - daily
          time: 2012-01-09 11:45:55.489322 +01:00
          title: daily
        "Schedule[puppet]": !ruby/object:Puppet::Resource::Status
          change_count: 0
          changed: false
          events: []
          failed: false
          file:
          line:
          out_of_sync: false
          out_of_sync_count: 0
          resource: "Schedule[puppet]"
          resource_type: Schedule
          skipped: true
          tags:
            - schedule
            - puppet
          time: 2012-01-09 11:45:55.513696 +01:00
          title: puppet
        "Schedule[monthly]": !ruby/object:Puppet::Resource::Status
          change_count: 0
          changed: false
          events: []
          failed: false
          file:
          line:
          out_of_sync: false
          out_of_sync_count: 0
          resource: "Schedule[monthly]"
          resource_type: Schedule
          skipped: true
          tags:
            - schedule
            - monthly
          time: 2012-01-09 11:45:55.490231 +01:00
          title: monthly
        "Schedule[never]": !ruby/object:Puppet::Resource::Status
          change_count: 0
          changed: false
          events: []
          failed: false
          file:
          line:
          out_of_sync: false
          out_of_sync_count: 0
          resource: "Schedule[never]"
          resource_type: Schedule
          skipped: true
          tags:
            - schedule
            - never
          time: 2012-01-09 11:45:55.509190 +01:00
          title: never
      status: changed
      time: 2012-01-09 11:45:52.907945 +01:00

</pre>

* On the one hand curl command with "**devtwo**" or another name for 
environment (or ghost env) return the same thing. "**Production**" it's the 
only env interpreted. In the puppet.conf, manifest or modulepath are completely 
ignored
* On the other hand a **puppetd -t --environment=devone/devtwo** on the node is 
fully functional


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to