help-cfengine
[Top][All Lists]
Advanced

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

Re: Relative imports.


From: Shawn Ferry
Subject: Re: Relative imports.
Date: Mon, 8 Sep 2003 13:06:18 -0400
User-agent: Mutt/1.4i

Relative paths depend on the executing programs idea of it's current
working directory.

If you can get the program to execute in your own hirearchy you could
have it load the malicious code.


As a solution to the original problem, why can't you do something like

<Top Level Import File>
control:
        linux_input = ( "$CFINPUTS/linux" )
        redhat_input = ( "$CFINPUTS/redhat" )
        redhat_9_input = ( "${redhat_input}/9" )

import:
        linux:: $linux_input/<file>
        redhat:: $readhat_input/<file>
        redhat9:: $readhat_9_input/<file>



I don't think you need to redefine CFINPUTS to get the portability you
want.   

A thought:

If you moved all of your files to redhat/i386/9  I would assume that you
would also use the class redhat_i386_9, which would imply that all
(or at least a subset of your classes would also have to change).

For, that I recommend sed.

Shawn

Quoting Hans Deragon <hans@deragon.biz> on Fri, Sep 05, 2003 at 09:12:06AM 
-0400:
> Greetings.
> 
> 
> Newbie here.  I have built many little cfengine scripts to modularize 
> fonctionnality.  The scripts are stored in subdirectories and import other
> scripts under other subdirectories.  There is however one thing I do not 
> really like and that is that in the import statements, I have to provide 
> the full path after $CFINPUTS.
> 
>   This is what I would like to be able to do:
> 
> File $CFINPUTS/A.cf:
> 
>   import:
> 
>      linux:: linux/B.cf
> 
> File $CFINPUTS/linux/B.cf:
> 
>   import:
> 
>      redhat:: redhat/C.cf
> 
> File $CFINPUTS/linux/redhat/C.cf:
> 
>   import:
> 
>     redhat_9::  9/D.cf
> 
> You get the picture?  For the moment, I must write file C.cf as:
> 
>   import:
> 
>      redhat_9::  linux/redhat/9/D.cf
> 
> ...but I would like to avoid having to prepend the import statement with 
> ¨linux/redhat¨.  The main reason is that as I work, I might want to 
> reorganise later the directories.  For instance, I might move the scripts 
> from ¨linux/redhat/9¨ to ¨linux/redhat/i386/9¨.  But this would require me 
> to edit all the scripts under the ¨9¨ directory.
> 
> Is there any way to reassign CFINPUTS locally in a script?
> 
> 
> Best regards,
> Hans Deragon
> -- 
> Consultant en informatique/Software Consultant
> Deragon Informatique inc.         Open source:
> http://www.deragon.biz            http://swtmvcwrapper.sourceforge.net
> mailto://hans@deragon.biz         http://autopoweroff.sourceforge.net
> 
> 
> 
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine

-- 
Shawn Ferry       sferry@sevenspace.com                                         
                                                                             
SevenSpace        Technical Lead and Sr. Principal Systems Engineer             
                                                                             
866.377.7223      www.sevenspace.com                                            
                                                                             




reply via email to

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