Re: [Puppet Users] Re: file content

2010-11-26 Thread Nigel Kersten
On Thu, Nov 25, 2010 at 2:08 AM, Arnau Bria arnaub...@pic.es wrote:

 That gave me the clue!
 From doc, ensure... it talks about possible values: present, absent...
 Anything other than those values will be considered to be a symlink

For what it's worth, I consider this a bug.

We should have present, absent, file, directory, symlink. If you
specify symlink, target is required.

Then we can cleanly add socket, etc on top of this structure.

http://projects.puppetlabs.com/issues/4938

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: file content

2010-11-25 Thread Arnau Bria
On Wed, 24 Nov 2010 21:13:37 +0100
Stefan Schulte wrote:

Hi all,

I think I get it...

class File default was:

File {
ensure  = prsent,
mode= 644,
owner   = root,
group   = root,
}

notice prsent... and not present.
^
 I dont think its working fine, when /etc/resolv.conf is now a link
 (ensure changed 'file' to 'link'). At first

That gave me the clue!
From doc, ensure... it talks about possible values: present, absent...
Anything other than those values will be considered to be a symlink

thanks!!!

 * don't use name. If anything, use path but I recommend just
 declaring file {'/etc/resolv.conf': content = ...).

Will do, but I have name in my prod env and works fine. 
Anyway, as it's not described in type ref and some of you already
recommended, I'll change.

 * If you still have strange results try to use an explicit ensure (you
   should always specfy one anyways. So use ensure = 'file' to make
 sure its a normal file
 * If you still get strange results, test to set target = undef and
   source = undef. If this helps, you have set a default somewhere.
   But maybe there is just a missing bracket somewhere so puppet will
 try to parse different resource definitions as one

thanks for the debugging tips :-)

 -Stefan
Cheers,
Arnau

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: file content

2010-11-24 Thread jcbollinger


On Nov 24, 6:17 am, Ohad Levy ohadl...@gmail.com wrote:
 You probably have a File statement somewhere (like site.pp) which has a
 default source or target attributes.

Right.  And if you do then it is certainly wrong, because default
source or target just does not make sense.

If that's not it, then make sure you're not including another File
resource with a different title but the same name property.


John

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: file content

2010-11-24 Thread jcbollinger


On Nov 24, 6:17 am, Ohad Levy ohadl...@gmail.com wrote:
 You probably have a File statement somewhere (like site.pp) which has a
 default source or target attributes.

Or, it could be because you have written name = where you want
path =.  Or you could omit both and simply title your resource with
the path, like so:

file { /etc/ntp.conf:
content = $src
}


John

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: file content

2010-11-24 Thread jcbollinger


On Nov 24, 5:32 am, Arnau Bria arnaub...@pic.es wrote:
[...]
 I tried the example 
 fromhttp://docs.puppetlabs.com/references/stable/type.html#filelike

 $srt=search mydomain.com \nnameserver 192.168.1.1 \
 \nnameserver192.168.1.2

 file {
'default_ntp':
  name= '/etc/ntp.conf',
  content = $srt#

 } }

 *notice double { at the end, as the exmaple shows, alo tried with simple 
 } with , and ; after $srt

 All my combinations produce and error. Double } syntax one (is doc wrong?) 
 and others same as above...

 So, how may I specify file content?

The second } at the end of that resource declaration is wrong.  A }
would appear in that location only if it was closing a surrounding
class, definition, or logic block.

I'm not sure you would need to do so, but you could try enclosing $src
in quotation marks, like so: $src.  The property binding may
optionally be followed by a comma (,) or, because it's the last
property declared for the resource, by a semicolon (;).  Thus, I might
write this:

file { /etc/ntp.conf:
content = $src
}

or this:

file { /etc/ntp.conf:
content = $src,
}

or this:

file { /etc/ntp.conf:
content = $src;
}


Also, I do recommend declaring the owner, group, and mode for the
file.


John

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: file content

2010-11-24 Thread Arnau Bria
On Wed, 24 Nov 2010 07:22:11 -0800 (PST)
jcbollinger jcbollinger wrote:


 On Nov 24, 6:17 am, Ohad Levy ohadl...@gmail.com wrote:
Hi !

I'm getting a little crazy with this... I'll paste some code and see if
you see what's happening...

  You probably have a File statement somewhere (like site.pp) which
  has a default source or target attributes.

Nop, I'm not defining source/content default.
 
 Right.  And if you do then it is certainly wrong, because default
 source or target just does not make sense.
Not my case, but maybe someone want to ensure that every file
defined at puppet has its content modified by source/content. So,
I could define a source/content with  should be modified by
puppet in it... i go to client and I see some file with that contetn I
know it's not controlled as desired... anyway, as I said not my case...

My problem:

node 'default' {
include  common_system_defaults 
}

site.pp defines a default:
# grep File site.pp 
File { ignore = .svn }


My class its own default:

class common_system_defaults {

File {
ensure  = prsent,
mode= 644,
owner   = root,
group   = root,
}

[ ... and my files ... ]

file {  
   'default_dns':
   name= '/etc/resolv.conf',
   content = search mydomain nameserver XXX.XXX.XXX.XXX;
'default_ntp':
   name= '/etc/ntp.conf',
   content = 'server myserver.mydomain prefer server 
myotherserver.mydomain';
}


# pwd
/etc/puppet/manifests
# grep -r content *|grep -v .svn
modules/common_defaults/manifests/init.pp:  content = 
search mydomain nameserver XXX.XXX.XXX.XXX;
modules/common_defaults/manifests/init.pp:  content = 
'server myserver.mydomain prefer server myotherserver.mydomain';

In resume, I want to modify resolv.conf and ntp.conf.

 in my client:

# puppetd --test --server $server 
info: Caching catalog for $client
err: Could not run Puppet configuration client: You cannot specify more than 
one of content, source, target at 
/etc/puppet/manifests/modules/common_defaults/manifests/init.pp:36

Line 36 i } of the above code...

where is content doubled?

If I commment default_ntp, the problems des not disappear:

file {  
   'default_dns':
   name= '/etc/resolv.conf',
   content = search mydomain nameserver XXX.XXX.XXX.XXX;
#'default_ntp':
#   name= '/etc/ntp.conf',
#   content = 'server myserver.mydomain prefer server 
myotherserver.mydomain';
}

# puppetd --test --server $server
info: Caching catalog for $client
err: Could not run Puppet configuration client: You cannot specify more than 
one of content, source, target at 
/etc/puppet/manifests/modules/common_defaults/manifests/init.pp:36

 If that's not it, then make sure you're not including another File
 resource with a different title but the same name property.

If I comment content line, all works fine:

file {  'default_dns':
name= '/etc/resolv.conf',
#   content = search pic.es nameserver 193.109.175.5 
nameserver 193.109.172.144 nameserver 158.109.0.1 nameserver 84.88.0.5;
}

info: Applying configuration version '1290614540'
info: FileBucket adding /etc/resolv.conf as 
{md5}6607f03347a11c61819976c8e28483bf
info: /Stage[main]/Common_system_defaults/File[default_dns]: Filebucketed 
/etc/resolv.conf to puppet with sum 6607f03347a11c61819976c8e28483bf
notice: /Stage[main]/Common_system_defaults/File[default_dns]/ensure: ensure 
changed 'file' to 'link'
notice: Finished catalog run in 0.37 seconds


So seems to me that no doubled name property defined...


Any help? I'm losing my patience with this  

 
 John
 
Cheers,
Arnau

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: file content

2010-11-24 Thread Arnau Bria
On Wed, 24 Nov 2010 07:39:09 -0800 (PST)
jcbollinger jcbollinger wrote:

 
 
 On Nov 24, 6:17 am, Ohad Levy ohadl...@gmail.com wrote:
  You probably have a File statement somewhere (like site.pp) which
  has a default source or target attributes.
 
 Or, it could be because you have written name = where you want
 path =.  Or you could omit both and simply title your resource with
 the path, like so:
 
 file { /etc/ntp.conf:
 content = $src
 }
 file {  '/etc/resolv.conf':
path= '/etc/resolv.conf',
content = whatever;
}


info: Caching catalog for services3.pic.es
err: Could not run Puppet configuration client: You cannot specify more than 
one of content, source, target at 
/etc/puppet/manifests/modules/common_defaults/manifests/init.pp:33

My prod environment works fine with 

file { 'descr':
name= $path ;
}


Now, after your reply, I've checked type ref and I don't see name
anymore... :-S

 
 John
Cheers,
Arnau

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: file content

2010-11-24 Thread Stefan Schulte
On Wed, Nov 24, 2010 at 05:03:45PM +0100, Arnau Bria wrote:
 On Wed, 24 Nov 2010 07:22:11 -0800 (PST)
 jcbollinger jcbollinger wrote:
 
 
  On Nov 24, 6:17 am, Ohad Levy ohadl...@gmail.com wrote:
 Hi !
 
 I'm getting a little crazy with this... I'll paste some code and see if
 you see what's happening...
 
   You probably have a File statement somewhere (like site.pp) which
   has a default source or target attributes.
 
 Nop, I'm not defining source/content default.
  
 If I comment content line, all works fine:
 
 file {  'default_dns':
 name= '/etc/resolv.conf',
 #   content = search pic.es nameserver 193.109.175.5 
 nameserver 193.109.172.144 nameserver 158.109.0.1 nameserver 84.88.0.5;
 }
 
 info: Applying configuration version '1290614540'
 info: FileBucket adding /etc/resolv.conf as 
 {md5}6607f03347a11c61819976c8e28483bf
 info: /Stage[main]/Common_system_defaults/File[default_dns]: Filebucketed 
 /etc/resolv.conf to puppet with sum 6607f03347a11c61819976c8e28483bf
 notice: /Stage[main]/Common_system_defaults/File[default_dns]/ensure: ensure 
 changed 'file' to 'link'
 notice: Finished catalog run in 0.37 seconds
 

I dont think its working fine, when /etc/resolv.conf is now a link (ensure 
changed 'file' to 'link'). At first
* don't use name. If anything, use path but I recommend just declaring
  file {'/etc/resolv.conf': content = ...).
* If you still have strange results try to use an explicit ensure (you
  should always specfy one anyways. So use ensure = 'file' to make sure
  its a normal file
* If you still get strange results, test to set target = undef and
  source = undef. If this helps, you have set a default somewhere.
  But maybe there is just a missing bracket somewhere so puppet will try
  to parse different resource definitions as one

-Stefan


pgpS88ksSKyMQ.pgp
Description: PGP signature