aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/manifests/init.pp
blob: 3c0b1909ddc4319cdc86b10d9d2ebdb6682d974a (plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
class buildsystem {
    class youri_submit {
        include sudo

        local_script {
            "mga-youri-submit": content => template("buildsystem/mga-youri-submit");
            "mga-youri-submit.wrapper": content => template("buildsystem/mga-youri-submit.wrapper");
            "submit_package": content => template('buildsystem/submit_package.pl');
        }

        sudo::sudoers_config { "mga-youri-submit":
            content => template("buildsystem/sudoers.youri")
        }

        package { "rpmlint": }

        file { "/etc/rpmlint/config":
            require => Package['rpmlint'],
            content => template("buildsystem/rpmlint.conf")
        }

        # directory that hold configuration auto extracted after upload
        # of the rpmlint policy
        file { "/etc/rpmlint/extracted.d/":
            ensure => directory,
            require => Package['rpmlint'],
            owner => $sched_login,
        }

        # ordering is automatic :
        # http://docs.puppetlabs.com/learning/ordering.html#autorequire
        file { "/etc/youri":
            ensure => "directory",
        }

        file {
            "/etc/youri/submit-todo.conf": content => template("buildsystem/submit-todo.conf");
            "/etc/youri/submit-upload.conf": content => template("buildsystem/submit-upload.conf");
            "/etc/youri/acl.conf": content => template("buildsystem/youri_acl.conf");
        }

        # FIXME use /usr/local/ once it will be in @INC
        file { '/usr/lib/perl5/vendor_perl/5.12.3/Youri/Repository/Mageia.pm':
            source => "puppet:///modules/buildsystem/Mageia.pm",
        }

        $package_list = ['perl-SVN', 'mdv-distrib-tools', 'perl-Youri-Media',
                         'perl-Youri-Package', 'perl-Youri-Repository',
                         'perl-Youri-Utils', 'perl-Youri-Config', 'mga-youri-submit']

        package { $package_list: }
    }

    # $groups: array of secondary groups (only local groups, no ldap)
    define sshuser($homedir, $comment, $groups = []) {
        group {"$title": 
            ensure => present,
        }

        user {"$title":
            ensure => present,
            comment => $comment,
            managehome => true,
	    home => $homedir,
            gid => $title,
	    groups => $groups,
            shell => "/bin/bash",
            notify => Exec["unlock$title"],
            require => Group[$title],
        }

        # set password to * to unlock the account but forbid login through login
        exec { "unlock$title":
            command => "usermod -p '*' $title",
            refreshonly => true,
        }

        file { $homedir:
            ensure => "directory",
            owner  => $title,
            group  => $title,
            require => User[$title],
        }

        file { "$homedir/.ssh":
            ensure => "directory",
            mode   => 600,
            owner  => $title,
            group  => $title,
            require => File[$homedir],
        }
    }

    # A script to copy on valstar the 2010.1 rpms built on jonund
    class sync20101 inherits base {
        $build_login = $buildsystem::iurt::user::login
        # TODO user iurt::user::homedir too
        local_script { "sync2010.1":
	        content => template("buildsystem/sync2010.1"),
        }
    }

    # a script to build 2010.1 packages. used on jonund
    class iurt20101 inherits base {
        $build_login = $buildsystem::iurt::user::login
        local_script { "iurt2010.1":
	        content => template("buildsystem/iurt2010.1"),
        }
    }
}