Updating /var/cfengine/modules

44 views
Skip to first unread message

Moore, Joe

unread,
Sep 21, 2016, 2:22:23 PM9/21/16
to help-c...@googlegroups.com

I’ve noticed that there is nothing in the default policies that updates /var/cfengine/modules (in particular …/packages/apt_get) from the policy server’s masterfiles.

 

Searching the group’s history, I found that Nick Anderson wrote (7/27/15):

>>> BS (Bruce Schultz)> One problem is that modules typically live in

>>> >$(sys.workdir)/modules ... is there any technical reason that they

>>> >could not be in services/modules instead?

>>> 

>>>In the past when I have wanted to ship modules inside of masterfiles, I

>>>just add a policy to copy from masterfiles into /var/cfengine/modules on

>>>the policy hub. The default update policy copies /var/cfengine/modules

>>>from the hub to /var/cfengine/modules on the remote agents.

 

I can’t find any other rationale for why the ${sys.workdir}/modules area would not be updated.

 

And this location is hardcoded in package_module.c:

static char *GetPackageModuleRealPath(const char *package_module_name)

{

   

    return StringFormat("%s%c%s%c%s%c%s", GetWorkDir(), FILE_SEPARATOR,

                        "modules", FILE_SEPARATOR, "packages", FILE_SEPARATOR,

                        package_module_name);

}

 

The /var/cfengine/modules/packages directory is initially created and populated by the packaging scripts (~cfengine/buildscripts/packaging/common/cfengine-non-hub/postinstall.sh) based on $PREFIX/share/CoreBase/modules/packages, which I’d say is just as reasonable as the copying of masterfiles from there.

 

But why doesn’t update.cf take care of this directory?

 

--Joe

Aleksey Tsalolikhin

unread,
Sep 21, 2016, 3:49:08 PM9/21/16
to Moore, Joe, help-cfengine

Dear Joe,

   The modules/ directory in workdir is intended for CFEngine's own modules, which ship with CFEngine, not user-defined modules.

  That's why there is no update policy for that directory. It is provided by the package and is not expected to change.
 
Best
Aleksey


--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengine+unsubscribe@googlegroups.com.
To post to this group, send email to help-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/help-cfengine.
For more options, visit https://groups.google.com/d/optout.

Moore, Joe

unread,
Sep 22, 2016, 3:29:38 PM9/22/16
to help-cfengine

Ok, that (somewhat) makes sense, except that https://docs.cfengine.com/lts/reference-standard-library-package_modules.html#the-package-module says that “The package module resides in the /var/cfengine/modules/packages both on the hub and the clients, and out of the box CFEngine is set up to synchronize this directory among its clients” which looks to me like it should be updated.

 

With the package module path hardcoded as /var/cfengine/modules/packages, there is no way to provide user-defined packaging modules (such as pip, npm, and others that are available in the old packages promises) in a supported fashion?

 

--Joe

To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengin...@googlegroups.com.


To post to this group, send email to help-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/help-cfengine.
For more options, visit https://groups.google.com/d/optout.

--

You received this message because you are subscribed to the Google Groups "help-cfengine" group.

To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengin...@googlegroups.com.

David Lee

unread,
Sep 23, 2016, 4:48:08 AM9/23/16
to Aleksey Tsalolikhin, help-cfengine, Moore, Joe
If the "modules" directory is not intended for a site's own modules, what is the proper place for a site's modules? (Is this documented somewhere?)

Thanks.

-- David


----- Original Message -----
> From: "Aleksey Tsalolikhin" <ale...@verticalsysadmin.com>
> To: "Moore, Joe" <joe....@siemens.com>
> Cc: "help-cfengine" <help-c...@googlegroups.com>
> Sent: Wednesday, 21 September, 2016 20:49:05
> Subject: Re: [help-cfengine] Updating /var/cfengine/modules

>> email to help-cfengin...@googlegroups.com.
>> To post to this group, send email to help-c...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/help-cfengine.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "help-cfengine" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to help-cfengin...@googlegroups.com.

Aleksey Tsalolikhin

unread,
Sep 23, 2016, 11:40:15 AM9/23/16
to David Lee, help-cfengine, Moore, Joe

Dear David,

  CFEngine suggests users put customization to the policy code into "services/" directory (as in, site-specific computing services); however in practice what I often see is people put their organizations code into a top-level directory like "acme/", so for example "acme/modules/".

Yours,
Aleksey


>> To post to this group, send email to help-c...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/help-cfengine.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "help-cfengine" group.
> To unsubscribe from this group and stop receiving emails from it, send an email

> To post to this group, send email to help-c...@googlegroups.com.
> Visit this group at https://groups.google.com/group/help-cfengine.
> For more options, visit https://groups.google.com/d/optout.

David Lee

unread,
Sep 23, 2016, 1:59:48 PM9/23/16
to Aleksey Tsalolikhin, help-cfengine, Moore, Joe
Aleksey,

Many thanks. (Still can't see where this is documented...)

-- David Lee
-- ECMWF
>> >> email to help-cfengin...@googlegroups.com.
>> >> To post to this group, send email to help-c...@googlegroups.com.
>> >> Visit this group at https://groups.google.com/group/help-cfengine.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >>
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "help-cfengine" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email
>> > to help-cfengin...@googlegroups.com.
>> > To post to this group, send email to help-c...@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/help-cfengine.
>> > For more options, visit https://groups.google.com/d/optout.
>>
> ᐧ
>
> --
> You received this message because you are subscribed to the Google Groups
> "help-cfengine" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to help-cfengin...@googlegroups.com.

Marco Marongiu

unread,
Sep 26, 2016, 10:37:07 AM9/26/16
to help-c...@googlegroups.com
Hi all

I use to put my own modules in /var/cfengine/modules together with the
ones bundled with cfengine, so that they are usable with the usemodule
function, for example

https://docs.cfengine.com/docs/3.6/reference-functions-usemodule.html

As for keeping the modules up to date, I ensure that any policy using
module X also ensures that it is updated (by issuing a remote copy from
the hub) before using it.

Ciao
-- bronto

Nick Anderson

unread,
Sep 26, 2016, 10:44:02 AM9/26/16
to Marco Marongiu, help-c...@googlegroups.com
On 09/26/2016 09:37 AM, Marco Marongiu wrote:
> As for keeping the modules up to date, I ensure that any policy using
> module X also ensures that it is updated (by issuing a remote copy from
> the hub) before using it.

The cfe_internal_update_policy_files_update_modules files promise in
cfe_internal/update/update_policy.cf should take care of syncing the
modules directory from the hub by default.

https://github.com/cfengine/masterfiles/blob/master/cfe_internal/update/update_policy.cf#L104-#L110

signature.asc

Aleksey Tsalolikhin

unread,
Sep 26, 2016, 10:52:41 PM9/26/16
to Nick Anderson, Joe Moore, help-cfengine
On Mon, Sep 26, 2016 at 7:43 AM, Nick Anderson <nick.a...@cfengine.com> wrote:


The cfe_internal_update_policy_files_update_modules files promise in
cfe_internal/update/update_policy.cf should take care of syncing the
modules directory from the hub by default.

https://github.com/cfengine/masterfiles/blob/master/cfe_internal/update/update_policy.cf#L104-#L110

My bad.  Thanks, Nick.  Let's get back to Joe's original question, then:

On Sep 21, 2016 11:22 AM, "Moore, Joe" <joe....@siemens.com> wrote:

I’ve noticed that there is nothing in the default policies that updates /var/cfengine/modules (in particular …/packages/apt_get) from the policy server’s masterfiles.


Joe, what version are you working with?  Could you please compare your masterfiles to the stock masterfiles?  You should have the modules_dir update promise that Nick mentioned.

Yours,
-at

Moore, Joe

unread,
Sep 27, 2016, 10:36:48 AM9/27/16
to help-c...@googlegroups.com
That's exactly what I was looking for. The only remaining question is "What the heck was I doing last week when it looked broken?"

:)

Thanks,
--Joe

-----Original Message-----
From: help-c...@googlegroups.com [mailto:help-c...@googlegroups.com] On Behalf Of Nick Anderson
Sent: Monday, September 26, 2016 10:44 AM
To: Marco Marongiu <bront...@gmail.com>; help-c...@googlegroups.com
Subject: Re: [help-cfengine] Updating /var/cfengine/modules

Reply all
Reply to author
Forward
0 new messages