Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-23 Thread Ted Zlatanov
On Tue, 22 May 2012 20:57:26 -0500 Nick Anderson wrote: NA> On 05/22/2012 08:41 PM, Nick Anderson wrote: >> https://cfengine.com/manuals/cf3-Reference#Function-getenv NA> So env contains USER, and with that we can get gid. NA> "user" string => getenv("USER","20"); NA> "no" int => get

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-22 Thread Nick Anderson
On 05/22/2012 08:41 PM, Nick Anderson wrote: > https://cfengine.com/manuals/cf3-Reference#Function-getenv So env contains USER, and with that we can get gid. "user" string => getenv("USER","20"); "no" int => getfields("$(user):.*","/etc/passwd",":","userdata"); "gid" string => "$(u

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-22 Thread Nick Anderson
On 05/22/2012 08:39 PM, Nick Anderson wrote: > Or what about accessing env USER https://cfengine.com/manuals/cf3-Reference#Function-getenv ___ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-22 Thread Nick Anderson
On 05/22/2012 08:35 PM, Nick Anderson wrote: > The next thing is two seperate command promises, one with a container, > one without classed on the presance of a variable being defined. Or what about accessing env USER ___ Help-cfengine mailing list Help-

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-22 Thread Nick Anderson
On 05/22/2012 08:33 PM, Nick Anderson wrote: > On 05/22/2012 08:26 PM, Ted Zlatanov wrote: >> Hmm. Can cfengine find out the current UID? If not, the default will >> be hard to do, unless I use two contain bodies, one with and one without >> the user specified. >> >> I can't find such getuid() fu

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-22 Thread Nick Anderson
On 05/22/2012 08:26 PM, Ted Zlatanov wrote: > Hmm. Can cfengine find out the current UID? If not, the default will > be hard to do, unless I use two contain bodies, one with and one without > the user specified. > > I can't find such getuid() functionality in the manual. It doesn't make > sense

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-22 Thread Ted Zlatanov
On Tue, 22 May 2012 18:25:20 -0500 Nick Anderson wrote: NA> On 05/22/2012 03:36 PM, Ted Zlatanov wrote: >> How about vcs_mirror? That's pretty clear and the term is not used by >> Git or Subversion. If you agree I'll make the change on my side. NA> Works for me. OK; done. NA> # TODO: provid

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-22 Thread Nick Anderson
On 05/22/2012 03:36 PM, Ted Zlatanov wrote: > How about vcs_mirror? That's pretty clear and the term is not used by > Git or Subversion. If you agree I'll make the change on my side. Works for me. > NA> # TODO: provide some way to selectivly contain the executing user > > Yeah, good point. Th

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-22 Thread Ted Zlatanov
On Tue, 22 May 2012 15:11:23 -0500 Nick Anderson wrote: NA> So in general are you preferring prefix to passing an array name with NA> new sketches? And also are you preferring a single usebundle call for NA> each different configuration? Yes, and yes. It makes passing data between JSON, Perl,

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-22 Thread Nick Anderson
On 05/22/2012 02:23 PM, Ted Zlatanov wrote: > You want "prefixVAR" instead of "prefix[VAR]". In other words, we're > passing a namespace prefix, not an array name, so all your variables are > named "main.repoVAR" (assuming you pass the prefix like that, although I > think "main.repo_" would be a m

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-22 Thread Ted Zlatanov
On Tue, 22 May 2012 12:50:39 -0500 Nick Anderson wrote: NA> On 05/21/2012 02:51 PM, Ted Zlatanov wrote: >> Nick, see if you can duplicate the bug on your side and I'll open the >> ticket. No rush, I have the fix above in place. NA> I tried to use it manually and none of the variables seem to e

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-22 Thread Nick Anderson
On 05/21/2012 02:51 PM, Ted Zlatanov wrote: > Nick, see if you can duplicate the bug on your side and I'll open the > ticket. No rush, I have the fix above in place. I tried to use it manually and none of the variables seem to expand. I have not tried with cfsketch yet. looks like all the [] a

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-21 Thread Ted Zlatanov
On Mon, 21 May 2012 15:51:11 -0400 Ted Zlatanov wrote: TZ> On Mon, 21 May 2012 15:21:20 -0400 Ted Zlatanov wrote: TZ> bundle agent vcs_freshclone(prefix) TZ> { TZ> vars: TZ> "bundle_home" string => dirname("$(this.promise_filename)"), TZ> policy => "overridable"; TZ> } TZ> is called from A/

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-21 Thread Ted Zlatanov
On Mon, 21 May 2012 15:21:20 -0400 Ted Zlatanov wrote: TZ> But it seems like `this.promise_filename' refers to the top-level TZ> (i.e. runme.cf) filename, even though the vcs_freshclone promises are TZ> made in a different file. This makes it impossible to find templates TZ> relative to the ske

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-21 Thread Nick Anderson
Ted Zlatanov wrote: >One more improvement: the .git/config file is now enforced :) > >This means that it's pretty much impossible for an attacker to make you >check out the wrong thing, even if they can modify the .git/config file >(they can always exploit a race condition, but it's still an >imp

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-21 Thread Ted Zlatanov
One more improvement: the .git/config file is now enforced :) This means that it's pretty much impossible for an attacker to make you check out the wrong thing, even if they can modify the .git/config file (they can always exploit a race condition, but it's still an improvement). But it seems lik

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-19 Thread Ted Zlatanov
On Fri, 18 May 2012 17:00:15 -0400 Ted Zlatanov wrote: TZ> OK, pushed to https://github.com/tzz/design-center.git I ran into one issue with the vcs_freshclone sketch, the vcs_configfile variable is not defined in time on the first pass, so it always tries to clone. I had to force just one VCS

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-18 Thread Ted Zlatanov
On Fri, 18 May 2012 15:17:12 -0400 Ted Zlatanov wrote: TZ> cfsketch itself will make it possible to activate this multiple times, TZ> so you don't have to deal with passing a 2-level array to describe TZ> multiple repositories. TZ> Although it will only support Git for now, I'm leaving the door

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-18 Thread Ted Zlatanov
On Thu, 17 May 2012 20:27:03 -0500 Nick Anderson wrote: NA> Hey Analogue, I submitted a pull request to the design-center earlier NA> today with a sketch that I think does what you were looking for. NA> https://github.com/cfengine/design-center/pull/49 NA> https://github.com/nickanderson/desig

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-17 Thread Nick Anderson
On 05/17/2012 01:14 PM, Ted Zlatanov wrote: > On Thu, 17 May 2012 12:51:39 -0500 Nick Anderson wrote: > > NA> Any new status updates on cfsketch to come along with that? > > Real Soon Now ;) > > Ted Hey Analogue, I submitted a pull request to the design-center earlier today with a sketch that I

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-17 Thread Ted Zlatanov
On Thu, 17 May 2012 12:51:39 -0500 Nick Anderson wrote: NA> Any new status updates on cfsketch to come along with that? Real Soon Now ;) Ted ___ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-17 Thread Nick Anderson
On 05/17/2012 12:40 PM, Ted Zlatanov wrote: > On Thu, 17 May 2012 12:34:10 -0500 Nick Anderson wrote: > > NA> On 05/17/2012 12:31 PM, Ted Zlatanov wrote: >>> On Thu, 17 May 2012 12:25:53 -0500 Nick Anderson wrote: > NA> On 05/16/2012 03:44 PM, Ted Zlatanov wrote: > I'd love to see native p

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-17 Thread Ted Zlatanov
On Thu, 17 May 2012 12:34:10 -0500 Nick Anderson wrote: NA> On 05/17/2012 12:31 PM, Ted Zlatanov wrote: >> On Thu, 17 May 2012 12:25:53 -0500 Nick Anderson wrote: NA> On 05/16/2012 03:44 PM, Ted Zlatanov wrote: I'd love to see native pluggable CFEngine support for VCS pulls, like it h

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-17 Thread Nick Anderson
On 05/17/2012 12:31 PM, Ted Zlatanov wrote: > On Thu, 17 May 2012 12:25:53 -0500 Nick Anderson wrote: > > NA> On 05/16/2012 03:44 PM, Ted Zlatanov wrote: >>> I'd love to see native pluggable CFEngine support for VCS pulls, like it >>> has for package management. > > NA> That would be cool. It se

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-17 Thread Ted Zlatanov
On Thu, 17 May 2012 12:25:53 -0500 Nick Anderson wrote: NA> On 05/16/2012 03:44 PM, Ted Zlatanov wrote: >> I'd love to see native pluggable CFEngine support for VCS pulls, like it >> has for package management. NA> That would be cool. It seems to be a pattern I do a lot with svn. And NA> now I

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-17 Thread Nick Anderson
On 05/16/2012 03:44 PM, Ted Zlatanov wrote: > I'd love to see native pluggable CFEngine support for VCS pulls, like it > has for package management. That would be cool. It seems to be a pattern I do a lot with svn. And now I have a way to do it with git. Threw this together https://gist.github.

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-16 Thread Ted Zlatanov
On Wed, 16 May 2012 14:33:03 -0500 Nick Anderson wrote: NA> On 05/16/2012 02:28 PM, no-re...@cfengine.com wrote: >> bundle agent git_master >> { >> commands: >> "/usr/bin/git pull origin" >> comment => "Update /repo from git repository", >> contain => silent_in_dir("/repo"); >> } NA> What hap

Re: CFEngine Help: Re: CFEngine Help: git promises

2012-05-16 Thread Nick Anderson
On 05/16/2012 02:28 PM, no-re...@cfengine.com wrote: > bundle agent git_master > { >commands: > "/usr/bin/git pull origin" >comment => "Update /repo from git repository", >contain => silent_in_dir("/repo"); > } What happens if some cowboy came in and manually twiddled an