~jcsackett/charmworld/bac-tag-constraints

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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Copyright 2012, 2013 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

# -*- coding: utf-8 -*-
"""
Load qa questions into the collection for populating the scoring parts of
the quality assessment form.

"""


def iter_categories():
    """Complete this function with work to be done for the migration/update.

    db is the pymongo db instance for our datastore. Charms are in db.charms
    for instance.
    """

    initial = [
        (
            u'reliable',
            u'Reliable',
            [
                (u'Check for integrity from upstream source', 1, u''),
                (u'Fail gracefully if upstream source goes missing', 1, u''),
                (u'Contain a suite of tests with the charm that pass', 1, u''),
                (u'Passes tests from Jenkins on jujucharms.com', 1, u''),
            ]
        ),

        (
            u'secure',
            u'Secure',
            [
                (u'Contain a well tested AppArmor profile', 1, ''),
                (u'Conform to security policies of the charm store', 1,
                 'Tight access control'),
                (u"Doesn't run as root", 1, ''),
                (u'Per instance or service access control', 1, ''),
            ]
        ),

        (
            u'flexible',
            u'Flexible',
            [
                (
                    u'Contain opinionated tuning options', 1,
                    u'Examples (depends on the service): "safe", "default",'
                    ' "fast", "real fast, not so safe". Don\'t expose every'
                    ' configuration, pick those that reflect real world usage.'
                    ' Make it so I don\'t have to read the book.'
                ),
                (u'Use existing interfaces with other charms', 1,
                 u'Highly relatable'),
            ]
        ),

        (
            u'data_handling',
            u'Data Handling',
            [
                (u'Integrate data storage best practices', 1,
                 u'Backups based on service usage'),
                (u"Handle the service's user data", 1, u'Version control'),
                (u"Handle the service's user data", 1,
                 u'Automated snapshots and backup.'),
            ]
        ),

        (
            u'scalable',
            u'Scaleable',
            [
                (u"Responds to add-unit based on the service's needs", 1,
                 u'Configuration should not require additional steps to scale'
                 ' horizontally'),
                (u'Be tested with a real workload, not just a synthetic'
                 ' benchmark', 1, ''),
                (u'From upstream and existing devops practices for that'
                 ' service', 1, ''),
                (u'Community peer reviewed', 1, ''),
                (u'Have a configure option for most performant configuration'
                 ' if not the default', 1, ''),
            ]
        ),

        (
            u'easy_deploy',
            u'Easy to Deploy',
            [
                (u'README with examples of use for a typical workload', 1, ''),
                (u'README with examples of use for workloads at scale', 1, ''),
                (u'README with examples of use recommend best-practice'
                 ' relationships', 1, ''),
                (u'Allow installation from pure upstream source', 1, ''),
                (u'Allow installation from your local source', 1, ''),
                (u'Allow installation from PPA (if available)', 1, ''),
                (u'Allow installation from the Ubuntu repository', 1, ''),
            ]
        ),

        (
            u'responsive',
            u'Responsive to DevOps Needs',
            [
                (u'Allow for easy upgrade via juju upgrade-charm', 1, ''),
                (u'Allow upgrading the service itself.', 1, ''),
                (u'Responsive to user bug reports and concerns', 1, ''),
                (u'Maintainable, easy to read and modify', 1, ''),
            ]
        ),

        (
            u'upstream',
            u'Upstream Friendly',
            [
                (u'Follow upstream best practices', 1,
                 u'Provide an option for a barebones "pure upstream"'
                 ' configuration'),
                (u'Should go lock-step with deployment recommendations', 1,
                 u'Provide tip-of-trunk testing if feasible'),
                (u'Fresh charm on release day!', 1, ''),
                (
                    u"Endeavour to be upstream's recommended way to deploy"
                    ' that service in the cloud (website mention or'
                    ' something)', 1, ''
                ),
            ]
        ),
    ]

    """Add the sample data into the db."""
    for cat in initial:
        category_dict = {
            'name': cat[0],
            'description': cat[1],
            'questions': [{
                'id': '{0}_{1}'.format(cat[0].lower(), i),
                'description': q[0],
                'points': q[1],
                'extended_description': q[2]
            } for i, q in enumerate(cat[2])]
        }
        yield category_dict