~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/qa_questions.py

  • Committer: Tarmac
  • Author(s): Aaron Bentley
  • Date: 2013-08-06 14:09:18 UTC
  • mfrom: (328.1.7 restore-questions)
  • Revision ID: tarmac-20130806140918-d8nkgw3oynufkb7p
[r=bac][bug=][author=abentley] Restore QA questions to migrations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2012, 2013 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
 
 
4
# -*- coding: utf-8 -*-
 
5
"""
 
6
Load qa questions into the collection for populating the scoring parts of
 
7
the quality assessment form.
 
8
 
 
9
"""
 
10
 
 
11
 
 
12
def iter_categories():
 
13
    """Complete this function with work to be done for the migration/update.
 
14
 
 
15
    db is the pymongo db instance for our datastore. Charms are in db.charms
 
16
    for instance.
 
17
    """
 
18
 
 
19
    initial = [
 
20
        (
 
21
            u'reliable',
 
22
            u'Reliable',
 
23
            [
 
24
                (u'Check for integrity from upstream source', 1, u''),
 
25
                (u'Fail gracefully if upstream source goes missing', 1, u''),
 
26
                (u'Contain a suite of tests with the charm that pass', 1, u''),
 
27
                (u'Passes tests from Jenkins on jujucharms.com', 1, u''),
 
28
            ]
 
29
        ),
 
30
 
 
31
        (
 
32
            u'secure',
 
33
            u'Secure',
 
34
            [
 
35
                (u'Contain a well tested AppArmor profile', 1, ''),
 
36
                (u'Conform to security policies of the charm store', 1,
 
37
                 'Tight access control'),
 
38
                (u"Doesn't run as root", 1, ''),
 
39
                (u'Per instance or service access control', 1, ''),
 
40
            ]
 
41
        ),
 
42
 
 
43
        (
 
44
            u'flexible',
 
45
            u'Flexible',
 
46
            [
 
47
                (
 
48
                    u'Contain opinionated tuning options', 1,
 
49
                    u'Examples (depends on the service): "safe", "default",'
 
50
                    ' "fast", "real fast, not so safe". Don\'t expose every'
 
51
                    ' configuration, pick those that reflect real world usage.'
 
52
                    ' Make it so I don\'t have to read the book.'
 
53
                ),
 
54
                (u'Use existing interfaces with other charms', 1,
 
55
                 u'Highly relatable'),
 
56
            ]
 
57
        ),
 
58
 
 
59
        (
 
60
            u'data_handling',
 
61
            u'Data Handling',
 
62
            [
 
63
                (u'Integrate data storage best practices', 1,
 
64
                 u'Backups based on service usage'),
 
65
                (u"Handle the service's user data", 1, u'Version control'),
 
66
                (u"Handle the service's user data", 1,
 
67
                 u'Automated snapshots and backup.'),
 
68
            ]
 
69
        ),
 
70
 
 
71
        (
 
72
            u'scalable',
 
73
            u'Scaleable',
 
74
            [
 
75
                (u"Responds to add-unit based on the service's needs", 1,
 
76
                 u'Configuration should not require additional steps to scale'
 
77
                 ' horizontally'),
 
78
                (u'Be tested with a real workload, not just a synthetic'
 
79
                 ' benchmark', 1, ''),
 
80
                (u'From upstream and existing devops practices for that'
 
81
                 ' service', 1, ''),
 
82
                (u'Community peer reviewed', 1, ''),
 
83
                (u'Have a configure option for most performant configuration'
 
84
                 ' if not the default', 1, ''),
 
85
            ]
 
86
        ),
 
87
 
 
88
        (
 
89
            u'easy_deploy',
 
90
            u'Easy to Deploy',
 
91
            [
 
92
                (u'README with examples of use for a typical workload', 1, ''),
 
93
                (u'README with examples of use for workloads at scale', 1, ''),
 
94
                (u'README with examples of use recommend best-practice'
 
95
                 ' relationships', 1, ''),
 
96
                (u'Allow installation from pure upstream source', 1, ''),
 
97
                (u'Allow installation from your local source', 1, ''),
 
98
                (u'Allow installation from PPA (if available)', 1, ''),
 
99
                (u'Allow installation from the Ubuntu repository', 1, ''),
 
100
            ]
 
101
        ),
 
102
 
 
103
        (
 
104
            u'responsive',
 
105
            u'Responsive to DevOps Needs',
 
106
            [
 
107
                (u'Allow for easy upgrade via juju upgrade-charm', 1, ''),
 
108
                (u'Allow upgrading the service itself.', 1, ''),
 
109
                (u'Responsive to user bug reports and concerns', 1, ''),
 
110
                (u'Maintainable, easy to read and modify', 1, ''),
 
111
            ]
 
112
        ),
 
113
 
 
114
        (
 
115
            u'upstream',
 
116
            u'Upstream Friendly',
 
117
            [
 
118
                (u'Follow upstream best practices', 1,
 
119
                 u'Provide an option for a barebones "pure upstream"'
 
120
                 ' configuration'),
 
121
                (u'Should go lock-step with deployment recommendations', 1,
 
122
                 u'Provide tip-of-trunk testing if feasible'),
 
123
                (u'Fresh charm on release day!', 1, ''),
 
124
                (
 
125
                    u"Endeavour to be upstream's recommended way to deploy"
 
126
                    ' that service in the cloud (website mention or'
 
127
                    ' something)', 1, ''
 
128
                ),
 
129
            ]
 
130
        ),
 
131
    ]
 
132
 
 
133
    """Add the sample data into the db."""
 
134
    for cat in initial:
 
135
        category_dict = {
 
136
            'name': cat[0],
 
137
            'description': cat[1],
 
138
            'questions': [{
 
139
                'id': '{0}_{1}'.format(cat[0].lower(), i),
 
140
                'description': q[0],
 
141
                'points': q[1],
 
142
                'extended_description': q[2]
 
143
            } for i, q in enumerate(cat[2])]
 
144
        }
 
145
        yield category_dict