[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: module output becomes an actionsequence?

From: Luke A. Kanies
Subject: Re: module output becomes an actionsequence?
Date: Thu, 2 Jan 2003 13:32:08 -0600 (CST)

On Thu, 2 Jan 2003, Ryan Anderson wrote:

> I have a home-made cfengine module written in shell that finds out which
> NIS domain a system is on and I can not get it to work with a config
> file I am creating. The module works elsewhere, but when I use it in
> conjunction with a variable, it puts the variable in as an
> actionsequence, then fails. This is running on Solaris 8. Its called
> module:mydomainname. It simply contains:


> My REAL question: Why is the file I want to copy, which is correctly
> determined; ie it IS finding out which domain its on, becoming an
> actionsequence? This is causing it all to fail. I'd rather avoid making
> a separate copy statement for each different domain & OS!

Unfortunately I have no idea why you're getting the file name into the
actionsequence; the only thing I can think is that somewhere else that
variable is referenced.

However, I think there's a way to avoid the whole module problem, and
probably thus avoid the issue you're having.

Do the following:

  # I don't know if this is necessary, but this makes sure cfengine
  # recognizes later classes as domains; you shouldn't need this, but...
  AddInstallable = ( mod_domain1 mod_domain2 mod_domain3 )

  # apparently ExecResult doesn't support |s, so I'm doing all the work
  # in perl...
  # you have to change all of the '.' characters to something else
  # cfengine only supports [a-zA-Z0-9_] in classes, I believe
  domcmd = "/usr/local/bin/perl -e '$d = qx|domainname|; $d =~ s/\./_/;
print $d;'" )

  # sets ${mydomain} to contain the current domain name
  mydomain = ( ExecResult(${domcmd}) )

  AddClasses ( "dom_{$mydomain}" )

    cf_file = ( "path/to/my/file")

    cf_file = ( "other/path/to/different/file" )


actionsequence = ( copy )



# if you name the file based on the domain

This cuts out the module, which will probably simplify things enough that
you can get it all to work.  I don't really know why cfengine doesn't
support pipes in ExecResult, but when I tried 'domainname | sed 's/\./_/g'
it tried to set my domainname.

Anyway, that should get rid of the need for the module, which should
hopefully solve your problem, although it doesn't answer your question.


We're not surrounded, we're in a target-rich environment!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]