jcbollinger has it right.  You're setting environment variables, and then 
exiting the environment.

Here's what is effectively happening:

# bash
# source ./opensh.rc
echo $OS_TOKEN
fbed3beb36960f2b3e1b
# exit
# echo $OS_TOKEN

#

When you tell Puppet to do an exec, it spawns a new instance of the shell 
(Probably bash), sets the path based on the path attribute, sets any 
variables in "environment", and executes your command.

Then the shell exits.

Your environment variables set via your script only exist within the scope 
of that (ephemeral) shell, so as soon as it exits, the variables go bye-bye 
as well.

Instead, consider this off-the-cuff example (Disclaimer:  I know nutzing 
about openstack!):

exec { 'openstack server create':
  cwd => '/root',
  path => '/bin;/sbin;/usr/bin;/usr/sbin',
  environment => [ 'OS_TOKEN="fbed3beb36960f2b3e1b"',
                   'OS_URL="http://openstack:35357/v3";',
                   'OS_IDENTITY_API_VERSION=3'
  ]
}

Which should pass the environment variables you want to the process you 
want to actually exec.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/e722c690-b1e1-40d0-b207-64b74b8cf392%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to