That regex doesn't look very nice. Are you sure running it from a regular shell produces what you want? What exactly is the net ads testjoin output look like?
It would be much simpler to use:
onlyif => "net ads testjoin 2>&1 | grep 'Join is OK'"
Which will use the return code of grep.
If your code is exactly as shown in this email you are also missing a ` in your only if test, and your command => is not closed either.
>setting this up that cares to share? Anyone try using the
>"refreshonly" option somehow? Again, my goal here is just for the net
>ads join to run when the server is NOT joined to the domain (which
>should be rarely). Thanks
>
>--
>You received this message because you are subscribed to the
>Google Groups "Puppet Users" group.
>To post to this group, send email to puppet...@googlegroups.com.
>To unsubscribe from this group, send email to
>puppet-users...@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/puppet-users?hl=en.
>
>
This email communication and any files transmitted with it may contain
confidential and or proprietary information and is provided for the use of the
intended recipient only. Any review, retransmission or dissemination of this
information by anyone other than the intended recipient is prohibited. If you
receive this email in error, please contact the sender and delete this
communication and any copies immediately. Thank you.
--vas_status.rb--
require 'facter'
vastool = '/opt/quest/bin/vastool'
if File.exists? vastool
`#{vastool} status`
if $?.success?
Facter.add("vas_status") do
setcode { "joined" }
end
else
Facter.add("vas_status") do
setcode { "unjoined" }
end
end
else
Facter.add("vas_status") do
setcode { "uninstalled" }
end
end
I created a module that
joins AD **unless** `verify_active_directory` returns good.
It depends on 2 essential scripts:
* verify_active_directory
- has machine been joined?
- is gssapi delegation enabled?
* join_active_directory
- join the domain
- enable gssapi delegation
I've posted the manifest and the templates for
{verify,join}_active_directory at:
https://gist.github.com/1982804
As written, the scripts also depend on...
* `unldif`, which is at:
https://github.com/jumanjiman/unldif
* `wd`, which as at:
https://github.com/jumanjiman/wd
If you don't want to install eiffelstudio in order to compilet `wd`,
simply remove `wd` from {verify,join}_active_directory.
`wd` is a watchdog that protects me from broken DNS lookups.
`unldif.sed` is absolutely essential to the scripts as written.
The scripts are somewhat commented, but
please let me know if you have specific questions about the scripts
(and by me, I mean the list).
If necessary, I can probably find some time during the day to
sanitize company info from the other files in the module and post
the other files, too. But the gist should get you started.
hth,
-paul
--
Paul Morgan <juman...@gmail.com>
RHCE, RHCDS, RHCVA, RHCSS, RHCA
http://github.com/jumanjiman
GPG Public Key ID: 0xf59e77c2
Fingerprint = 3248 D0C8 4B42 2F7C D92A AEA0 7D20 6D66 F59E 77C2
On Mar 5, 2012 3:36 PM, "Kinzel, David" <David....@encana.com> wrote:
> It would be much simpler to use:
>
> onlyif => "net ads testjoin 2>&1 | grep 'Join is OK'"
>
> Which will use the return code of grep.
Idk the onlyif interface offhand but you probably want a -q on the grep to suppress output. So,
grep -q 'Join is OK'
or
fgrep -q 'Join is OK'
-Jeremy