Custom Fact used in exec command

25 views
Skip to first unread message

Aaron Shegrud

unread,
Apr 23, 2014, 8:10:49 PM4/23/14
to puppet...@googlegroups.com
I created a fact, loaded it into the my modules/[module]/lib/facter/ directory
it synchronized across all my users.
I can see the fact in puppet-dashboard for all of my users:
mac_airport_iden1

but I cannot seem to use it in a command.

I'm trying to run this command:

exec {'killwifi':

    command => '/usr/sbin/networksetup -setairportpower ${mac_airport_id} off',

}

but am getting an error on each run:

Could not match ${mac_airport_id}


I might just be going blind today missing simple things all day...




Jason Slagle

unread,
Apr 23, 2014, 8:48:34 PM4/23/14
to puppet...@googlegroups.com

On 4/23/14, 8:10 PM, "Aaron Shegrud" <sheg...@gmail.com> wrote:


>I created a fact, loaded it into the my modules/[module]/lib/facter/
>directory
>it synchronized across all my users.
>I can see the fact in puppet-dashboard for all of my
>users:mac_airport_iden1
>but I cannot seem to use it in a command.
>
>I'm trying to run this command:
>
>exec {'killwifi':
> command => '/usr/sbin/networksetup -setairportpower
>${mac_airport_id} off',
> }
>
>but am getting an error on each run:
>Could not match ${mac_airport_id}
>
>
>

You need double quotes ­ single quotes don¹t interpret variables.

See http://docs.puppetlabs.com/learning/manifests.html

Jason


Aaron Shegrud

unread,
Apr 23, 2014, 9:12:11 PM4/23/14
to puppet...@googlegroups.com
damn! I knew it was going to be easy.
thanks
and thanks again community! today was not my day...
Reply all
Reply to author
Forward
0 new messages