当我尝试执行递归部署目录移动到已经包含大量文件的文件夹中。
我的系统上用户资源使用的提供程序似乎没有将 /etc/skel 中的文件部署到新配置的目录中。因此,在我看来,我可以使用这种递归部署来填充目录,如下所示。
# password is in the vault
user { "myuser":
ensure => 'present',
password => 'guessmypassword',
home => '/home/myuser',
shell => '/bin/bash',
}
file { '/home/myuser':
ensure => directory,
owner => 'myuser',
group => 'myuser',
mode => 0755,
require => User['myuser'],
}
file { '/home/myuser/.ssh':
ensure => directory,
owner => 'myuser',
group => 'myuser',
mode => 0700,
require => User['myuser'],
}
file { 'myuser_skeleton':
path => '/home/myuser',
source => '/etc/skel',
owner => 'myuser',
group => 'myuser',
recurse => true,
replace => false,
}
问题似乎出现在用户在其中一个系统上拥有一个包含约 5,000 个文件的项目的 svn 工作副本。在该系统上运行的 puppet 似乎在 40 分钟内一直处于 100% 状态。
我在 strace 下运行了 puppet,在锁定期间,它似乎对某些文件不断调用 gettimeofday() 超过 4000 次,然后它移动到下一个并重复。
munmap(0xb6ffc000, 4096) = 0
lstat64("/home/myuser/ptlib/include/ptlib/Nucleus++/ptlib/.svn/tmp/props", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/home/myuser", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2819, ...}) = 0
lstat64("/home/myuser/ptlib/src/ptlib/common/.svn/prop-base/sfile.cxx.svn-base", {st_mode=S_IFREG|0444, st_size=109, ...}) = 0
stat64("/usr/local/lib/site_ruby/1.8/digest/md5.rb", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/site_ruby/1.8/digest/md5.so", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/site_ruby/1.8/i486-linux/digest/md5.rb", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/site_ruby/1.8/i486-linux/digest/md5.so", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/site_ruby/1.8/i386-linux/digest/md5.rb", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/site_ruby/1.8/i386-linux/digest/md5.so", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/site_ruby/digest/md5.rb", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/site_ruby/digest/md5.so", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/ruby/vendor_ruby/1.8/digest/md5.rb", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/ruby/vendor_ruby/1.8/digest/md5.so", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/ruby/vendor_ruby/1.8/i486-linux/digest/md5.rb", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/ruby/vendor_ruby/1.8/i486-linux/digest/md5.so", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/ruby/vendor_ruby/digest/md5.rb", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/ruby/vendor_ruby/digest/md5.so", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/ruby/1.8/digest/md5.rb", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/ruby/1.8/digest/md5.so", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/ruby/1.8/i486-linux/digest/md5.rb", 0xbff645f0) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/ruby/1.8/i486-linux/digest/md5.so", {st_mode=S_IFREG|0644, st_size=6848, ...}) = 0
open("/usr/lib/ruby/1.8/i486-linux/digest/md5.so", O_RDONLY|O_LARGEFILE) = 6
fstat64(6, {st_mode=S_IFREG|0644, st_size=6848, ...}) = 0
close(6) = 0
open("/home/myuser/ptlib/src/ptlib/common/.svn/prop-base/sfile.cxx.svn-base", O_RDONLY|O_LARGEFILE) = 6
fstat64(6, {st_mode=S_IFREG|0444, st_size=109, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6ffc000
read(6, "K 17\nCVSRevisionNumber\nV 3\n1.3\nK"..., 4096) = 109
read(6, "", 4096) = 0
close(6) = 0
munmap(0xb6ffc000, 4096) = 0
lstat64("/home/myuser/ptlib/plugins/vidinput_bsd/.svn/props", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/home/myuser", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2819, ...}) = 0
gettimeofday({1319573116, 304890}, NULL) = 0
gettimeofday({1319573116, 304951}, NULL) = 0
gettimeofday({1319573116, 304993}, NULL) = 0
gettimeofday({1319573116, 305034}, NULL) = 0
... repeats ~4000 times.
gettimeofday({1319573116, 305075}, NULL) = 0
gettimeofday({1319573116, 305116}, NULL) = 0
gettimeofday({1319573116, 305158}, NULL) = 0
gettimeofday({1319573116, 305199}, NULL) = 0
gettimeofday({1319573116, 305245}, NULL) = 0
brk(0xbbf1000) = 0xbbf1000
brk(0xbc12000) = 0xbc12000
brk(0xbc33000) = 0xbc33000
brk(0xbc55000) = 0xbc55000
brk(0xbc76000) = 0xbc76000
brk(0xbc98000) = 0xbc98000
... repeats 200 times
stat64("/etc/skel", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/etc/skel", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/etc/skel", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/etc/skel", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 6
brk(0xc334000) = 0xc334000
lseek(6, 0, SEEK_SET) = 0
getdents64(6, /* 5 entries */, 32768) = 144
getdents64(6, /* 0 entries */, 32768) = 0
close(6) = 0
... and one
答案1
使用recurse => remote
而不是recurse => true
——这将只扫描服务器端的文件而不是客户端。
远程 — 递归进入远程目录,但不进入本地目录。允许将少量文件复制到包含许多非托管文件的目录中,而无需扫描所有本地文件。