Hi,
It seems like this should be pretty easy but I can''t find a solution.
On my puppet master, I have a directory of zipped files. These are created
by another application. When a new zipped file is added to the directory,
the other application attaches a symlink to it called current.
/somepath/repo-1.tar.gz -> current
Then later...
/somepath/repo1.tar.gz
/somepath/repo-2.tar.gz -> current
I want puppet to copy the file pointed to by ''current'' to the
clients.
So far I have the following which will copy the file but, the name of the
file on the client is ''current''. I want it to be the actual
name of the
file and not the name of the link.
class ams::config
{
file {
"ams_repos":
path => "/tmp/current", #????
owner => ''root'',
group => ''root'',
mode => 0644,
backup => true,
ensure => present,
links => follow,
source => "puppet:///repo_files/current",
}
}
Any help would be greatly appreciated.
Thanks in advance!
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/_iquOLoCVQwJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
It looks like you should be able to do something like this:
$linkvalue = generate(''/usr/bin/readlink'',
''/somepath/current'');
$linkbasename = generate(''/usr/bin/basename'', $linkvalue);
and then
path -> "destinationpath/$linkbasename",
tom
On 5/3/12 2:03 PM, rjl wrote:> Hi,
> It seems like this should be pretty easy but I can''t find a
solution.
>
> On my puppet master, I have a directory of zipped files. These are
> created by another application. When a new zipped file is added to the
> directory, the other application attaches a symlink to it called current.
>
> /somepath/repo-1.tar.gz -> current
>
> Then later...
>
> /somepath/repo1.tar.gz
> /somepath/repo-2.tar.gz -> current
>
> I want puppet to copy the file pointed to by ''current'' to
the clients.
>
> So far I have the following which will copy the file but, the name of
> the file on the client is ''current''. I want it to be the
actual name of
> the file and not the name of the link.
>
> class ams::config
> {
> file {
> "ams_repos":
> path => "/tmp/current", #????
> owner => ''root'',
> group => ''root'',
> mode => 0644,
> backup => true,
> ensure => present,
> links => follow,
> source => "puppet:///repo_files/current",
> }
> }
>
> Any help would be greatly appreciated.
>
> Thanks in advance!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/_iquOLoCVQwJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Thanks for the reply Tom (didn''t need the basename call). That works
great
for getting the filename. However, now my path is not getting evaluated
correctly. I have this in my /etc/puppet/fileserver.conf
[ams_repo_path]
path /opt/level3/component/ams/repo
allow *
Here is my class
class ams::config
{
$realname =
generate(''/usr/bin/readlink'',''/opt/level3/component/ams/repo/current'')
file {
"repo_files":
path => "/tmp/$realname",
owner => ''root'',
group => ''root'',
mode => 0644,
backup => true,
#links => ignore,
ensure => present,
source => "puppet:///ams_repo_path/$realname",
}
}
My client is now complaining...
May 3 20:40:40 devrep0114 puppet-agent[32264]:
(/Stage[main]/Ams::Config/File[repo_files]) Could not evaluate: Could not
retrieve information from source(s)
puppet:///ams_repo_path/1329498772.tar.gz at
/etc/puppet/modules/ams/manifests/config.pp:22
If I change replace the $realname variable above with the link name
(current), then puppet will copy the tar file over but it will be named
''current''. This indicates that
''ams_repo_path'' is being properly evaluated.
Ideas?
On Thursday, May 3, 2012 1:24:27 PM UTC-6, Thomas A. Fine
wrote:>
> It looks like you should be able to do something like this:
>
> $linkvalue = generate(''/usr/bin/readlink'',
''/somepath/current'');
> $linkbasename = generate(''/usr/bin/basename'',
$linkvalue);
>
> and then
>
> path -> "destinationpath/$linkbasename",
>
> tom
>
> On 5/3/12 2:03 PM, rjl wrote:
> > Hi,
> > It seems like this should be pretty easy but I can''t find a
solution.
> >
> > On my puppet master, I have a directory of zipped files. These are
> > created by another application. When a new zipped file is added to the
> > directory, the other application attaches a symlink to it called
> current.
> >
> > /somepath/repo-1.tar.gz -> current
> >
> > Then later...
> >
> > /somepath/repo1.tar.gz
> > /somepath/repo-2.tar.gz -> current
> >
> > I want puppet to copy the file pointed to by
''current'' to the clients.
> >
> > So far I have the following which will copy the file but, the name of
> > the file on the client is ''current''. I want it to be
the actual name of
> > the file and not the name of the link.
> >
> > class ams::config
> > {
> > file {
> > "ams_repos":
> > path => "/tmp/current", #????
> > owner => ''root'',
> > group => ''root'',
> > mode => 0644,
> > backup => true,
> > ensure => present,
> > links => follow,
> > source => "puppet:///repo_files/current",
> > }
> > }
> >
> > Any help would be greatly appreciated.
> >
> > Thanks in advance!
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Puppet Users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/puppet-users/-/_iquOLoCVQwJ.
> > To post to this group, send email to puppet-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > puppet-users+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/puppet-users?hl=en.
>
>
On Thursday, May 3, 2012 1:24:27 PM UTC-6, Thomas A. Fine
wrote:>
> It looks like you should be able to do something like this:
>
> $linkvalue = generate(''/usr/bin/readlink'',
''/somepath/current'');
> $linkbasename = generate(''/usr/bin/basename'',
$linkvalue);
>
> and then
>
> path -> "destinationpath/$linkbasename",
>
> tom
>
> On 5/3/12 2:03 PM, rjl wrote:
> > Hi,
> > It seems like this should be pretty easy but I can''t find a
solution.
> >
> > On my puppet master, I have a directory of zipped files. These are
> > created by another application. When a new zipped file is added to the
> > directory, the other application attaches a symlink to it called
> current.
> >
> > /somepath/repo-1.tar.gz -> current
> >
> > Then later...
> >
> > /somepath/repo1.tar.gz
> > /somepath/repo-2.tar.gz -> current
> >
> > I want puppet to copy the file pointed to by
''current'' to the clients.
> >
> > So far I have the following which will copy the file but, the name of
> > the file on the client is ''current''. I want it to be
the actual name of
> > the file and not the name of the link.
> >
> > class ams::config
> > {
> > file {
> > "ams_repos":
> > path => "/tmp/current", #????
> > owner => ''root'',
> > group => ''root'',
> > mode => 0644,
> > backup => true,
> > ensure => present,
> > links => follow,
> > source => "puppet:///repo_files/current",
> > }
> > }
> >
> > Any help would be greatly appreciated.
> >
> > Thanks in advance!
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Puppet Users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/puppet-users/-/_iquOLoCVQwJ.
> > To post to this group, send email to puppet-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > puppet-users+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/puppet-users?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/_XuPOxrGR94J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Found the problem. Looks like a return character...here is my solution.
$realname =
regsubst(generate(''/usr/bin/readlink'',''/opt/level3/component/ams/repo/current''),''^(.*)\n$'',''\1'')
On Thursday, May 3, 2012 12:03:59 PM UTC-6, rjl wrote:>
> Hi,
> It seems like this should be pretty easy but I can''t find a
solution.
>
> On my puppet master, I have a directory of zipped files. These are created
> by another application. When a new zipped file is added to the directory,
> the other application attaches a symlink to it called current.
>
> /somepath/repo-1.tar.gz -> current
>
> Then later...
>
> /somepath/repo1.tar.gz
> /somepath/repo-2.tar.gz -> current
>
> I want puppet to copy the file pointed to by ''current'' to
the clients.
>
> So far I have the following which will copy the file but, the name of the
> file on the client is ''current''. I want it to be the
actual name of the
> file and not the name of the link.
>
> class ams::config
> {
> file {
> "ams_repos":
> path => "/tmp/current", #????
> owner => ''root'',
> group => ''root'',
> mode => 0644,
> backup => true,
> ensure => present,
> links => follow,
> source => "puppet:///repo_files/current",
> }
> }
>
> Any help would be greatly appreciated.
>
> Thanks in advance!
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/a3OSBsn4R5YJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.