Merge lp:snappy/15.04 into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Michael Vogt
Status: Merged
Merged at revision: 711
Proposed branch: lp:snappy/15.04
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 152 lines (+68/-48)
3 files modified
coreconfig/config.go (+12/-3)
coreconfig/config_test.go (+12/-0)
docs/oem.md (+44/-45)
To merge this branch: bzr merge lp:snappy/15.04
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Review via email: mp+271625@code.launchpad.net

Description of the change

Merge fixes from 15.04 back into trunk.

To post a comment you must log in.
lp:snappy/15.04 updated
709. By David Callé

Markdown fix in docs/oem.md by davidc3 approved by mvo

710. By Federico Gimenez

Avoid a panic when coreconfig is given invalid config. by chipaca approved by mvo

711. By Michael Vogt

merged lp:snappy

Revision history for this message
John Lenton (chipaca) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'coreconfig/config.go'
2--- coreconfig/config.go 2015-09-15 21:35:38 +0000
3+++ coreconfig/config.go 2015-09-23 08:39:03 +0000
4@@ -58,9 +58,15 @@
5 watchdogStartupPath = "/etc/default/watchdog"
6 )
7
8-// ErrInvalidUnitStatus signals that a unit is not returning a status
9-// of "enabled" or "disabled".
10-var ErrInvalidUnitStatus = errors.New("invalid unit status")
11+var (
12+ // ErrInvalidUnitStatus signals that a unit is not returning a status
13+ // of "enabled" or "disabled".
14+ ErrInvalidUnitStatus = errors.New("invalid unit status")
15+
16+ // ErrInvalidConfig is returned from Set when the value
17+ // provided is not a valid configuration string.
18+ ErrInvalidConfig = errors.New("invalid ubuntu-core configuration")
19+)
20
21 type systemConfig struct {
22 Autopilot *bool `yaml:"autopilot,omitempty"`
23@@ -194,6 +200,9 @@
24 return "", err
25 }
26 newConfig := configWrap.Config.UbuntuCore
27+ if newConfig == nil {
28+ return "", ErrInvalidConfig
29+ }
30
31 rNewConfig := reflect.ValueOf(newConfig).Elem()
32 rType := rNewConfig.Type()
33
34=== modified file 'coreconfig/config_test.go'
35--- coreconfig/config_test.go 2015-09-15 21:36:22 +0000
36+++ coreconfig/config_test.go 2015-09-23 08:39:03 +0000
37@@ -148,6 +148,18 @@
38 c.Assert(rawConfig, Equals, expected)
39 }
40
41+func (cts *ConfigTestSuite) TestSetBadValueDoesNotPanic(c *C) {
42+ for _, s := range []string{
43+ "",
44+ "\n",
45+ "config:\n",
46+ "config:\n ubuntu-core:\n",
47+ } {
48+ _, err := Set(s)
49+ c.Assert(err, Equals, ErrInvalidConfig)
50+ }
51+}
52+
53 // TestSetTimezone is a broad test, close enough to be an integration test.
54 func (cts *ConfigTestSuite) TestSetTimezone(c *C) {
55 // TODO figure out if we care about exact output or just want valid yaml.
56
57=== modified file 'docs/oem.md'
58--- docs/oem.md 2015-09-11 20:13:00 +0000
59+++ docs/oem.md 2015-09-23 08:39:03 +0000
60@@ -193,48 +193,47 @@
61
62 As an example
63
64-```yaml
65-name: beagleboneblack.sergiusens
66-vendor: Sergio Schvezov <sergiusens@gmail.com>
67-icon: meta/element14.png
68-version: 1.1
69-type: oem
70-
71-config:
72- ubuntu-core:
73- hostname: myhostname
74- no-cloud: true
75- config-example.canonical:
76- msg: Yay!
77-
78-immutable-config:
79- - ubuntu-core/services/*
80- - webdm/*
81-
82-oem:
83- store:
84- id: mystore
85- branding:
86- name: Beagle Bone Black
87- logo: logo.png
88- software:
89- built-in:
90- - webdm
91- preinstalled:
92- - system-status.victor
93- - pastebinit.mvo
94- - config-example.canonical
95- hardware:
96- platform: am335x-boneblack
97- architecture: armhf
98- partition-layout: system-AB
99- bootloader: u-boot
100- boot-assets:
101- files:
102- - path: uEnv.txt
103- raw-files:
104- - path: MLO
105- offset: 131072 # 128 * 1024
106- - path: u-boot.img
107- offset: 393216 # 384 * 1024
108-```
109+
110+ name: beagleboneblack.sergiusens
111+ vendor: Sergio Schvezov <sergiusens@gmail.com>
112+ icon: meta/element14.png
113+ version: 1.1
114+ type: oem
115+
116+ config:
117+ ubuntu-core:
118+ hostname: myhostname
119+ no-cloud: true
120+ config-example.canonical:
121+ msg: Yay!
122+
123+ immutable-config:
124+ - ubuntu-core/services/*
125+ - webdm/*
126+
127+ oem:
128+ store:
129+ id: mystore
130+ branding:
131+ name: Beagle Bone Black
132+ logo: logo.png
133+ software:
134+ built-in:
135+ - webdm
136+ preinstalled:
137+ - system-status.victor
138+ - pastebinit.mvo
139+ - config-example.canonical
140+ hardware:
141+ platform: am335x-boneblack
142+ architecture: armhf
143+ partition-layout: system-AB
144+ bootloader: u-boot
145+ boot-assets:
146+ files:
147+ - path: uEnv.txt
148+ raw-files:
149+ - path: MLO
150+ offset: 131072 # 128 * 1024
151+ - path: u-boot.img
152+ offset: 393216 # 384 * 1024

Subscribers

People subscribed via source and target branches