Information Technology Reference
In-Depth Information
Listing 12.2: Specifying a symbolic link in Puppet
Click here to view code image
file { '/tmp/link -to -motd ':
ensure => 'link ',
target => '/etc/motd ',
}
Listing 12.3: Creating a symbolic link in Python
Click here to view code image
import os
def make_symlink(filename , target):
if os.path.lexists(filename):
if os.path.islink(filename):
if os.readlink(filename) == target:
return
os.unlink(filename)
os.symlink(target , filename)
make_symlink ('/tmp/link -to-motd ', '/etc/motd ')
Listing 12.4: Creating a symbolic link in Perl
Click here to view code image
sub make_symlink {
my ($filename , $target) = ($_[0], $_ [1]);
if (-l $filename) {
return if readlink($filename) eq $target;
unlink $filename;
} elsif (-e $filename) {
unlink $filename;
}
symlink($target , $filename);
}
make_symlink ('/tmp/link -to-motd ', '/etc/motd ');
Configuration management systems usually have features that let you build up defini-
tions from other definitions. For example, there may be a definition of a “generic server,”
Search WWH ::




Custom Search