1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
hostclass "buildsystem::distros" do
mirror_user = 'root'
schedbot_user = scope.lookupvar('buildsystem::var::scheduler::login')
bootstrap_reporoot = scope.lookupvar('buildsystem::var::repository::bootstrap_reporoot')
scope.lookupvar('buildsystem::var::distros::distros').each{|rel, distro|
file [ bootstrap_reporoot, rel ].join('/'), :ensure => 'directory',
:owner => mirror_user, :group => mirror_user
for arch in distro['arch'] do
# As ruby dsl cannot use defined resources, we have to use a
# workaround with 'find_resource_type' as described in this
# puppet issue: http://projects.puppetlabs.com/issues/11912
scope.find_resource_type 'buildsystem::media_cfg'
media_cfg_args = {
:distro_name => rel,
:arch => arch,
}
if distro['tmpl_media.cfg'] != nil
media_cfg_args['templatefile'] = distro['tmpl_media.cfg']
end
if ! distro['no_media_cfg_update']
create_resource 'buildsystem::media_cfg',
[ rel, ' ', arch ].join('/'), media_cfg_args
end
file [ bootstrap_reporoot, rel, arch ].join('/'),
:ensure => 'directory', :owner => schedbot_user,
:group => schedbot_user
mediadir = [ bootstrap_reporoot, rel, arch, 'media' ].join('/')
file mediadir, :ensure => 'directory', :owner => schedbot_user,
:group => schedbot_user
file [ mediadir, 'media_info' ].join('/'), :ensure => 'directory',
:owner => schedbot_user, :group => schedbot_user
file [ mediadir, 'debug' ].join('/'), :ensure => 'directory',
:owner => mirror_user, :group => mirror_user
distro['medias'].each{|media, m|
file [ mediadir, media ].join('/'), :ensure => 'directory',
:owner => schedbot_user, :group => schedbot_user
file [ mediadir, 'debug', media ].join('/'),
:ensure => 'directory', :owner => schedbot_user,
:group => schedbot_user
for repo in m['repos'].keys do
file [ mediadir, media, repo ].join('/'),
:ensure => 'directory', :owner => schedbot_user,
:group => schedbot_user
file [ mediadir, media, repo, 'media_info' ].join('/'),
:ensure => 'directory', :owner => schedbot_user,
:group => schedbot_user
file [ mediadir, 'debug', media, repo ].join('/'),
:ensure => 'directory', :owner => schedbot_user,
:group => schedbot_user
file [ mediadir, 'debug', media, repo, 'media_info' ].join('/'),
:ensure => 'directory', :owner => schedbot_user,
:group => schedbot_user
end
}
if distro['based_on'] != nil
distro['based_on'].each{|bdistroname, medias|
file [ mediadir, bdistroname ].join('/'),
:ensure => 'directory', :owner => mirror_user,
:group => mirror_user
medias.each{|medianame, media|
mdir = [ mediadir, bdistroname, medianame ].join('/')
file mdir, :ensure => 'directory',
:owner => mirror_user, :group => mirror_user
for reponame in media
file [ mdir, reponame ].join('/'),
:ensure => 'link',
:target => [
'../../../../..', bdistroname, arch,
'media', medianame, reponame ].join('/'),
:owner => mirror_user, :group => mirror_user
end
}
}
end
end
# SRPMS
srpmsdir = [ bootstrap_reporoot, rel, 'SRPMS' ].join('/')
file srpmsdir,
:ensure => 'directory', :owner => mirror_user,
:group => mirror_user
distro['medias'].each{|media, m|
file [ srpmsdir, media ].join('/'), :ensure => 'directory',
:owner => schedbot_user, :group => schedbot_user
for repo in m['repos'].keys do
file [ srpmsdir, media, repo ].join('/'),
:ensure => 'directory', :owner => schedbot_user,
:group => schedbot_user
end
}
}
end
|