Permalink
Browse files

#219: Fix the order of fetch vs append (fixes #218)

Fixes #218 by ensuring that a layers deps are (recursively) appended to the list before itself. This fixes a regression from 87c26dc
  • Loading branch information...
1 parent d1d36a6 commit f651e144fe24879a0470c8e49ab792a9321e6b4b @johnsca johnsca committed with marcoceppi Jun 8, 2016
Showing with 13 additions and 2 deletions.
  1. +2 −1 charmtools/build/builder.py
  2. +5 −1 tests/test_build.py
  3. +1 −0 tests/trusty/mysql/layer.yaml
  4. +5 −0 tests/trusty/test-base/config.yaml
@@ -285,8 +285,9 @@ def fetch_dep(self, layer, results):
base_layer = Layer(base, self.deps)
if base_layer.name in [i.name for i in results['layers']]:
continue
- results["layers"].append(base_layer.fetch())
+ base_layer.fetch()
self.fetch_dep(base_layer, results)
+ results["layers"].append(base_layer)
def build_tactics(self, entry, current, config, output_files):
# Delegate to the config object, it's rules
View
@@ -80,11 +80,15 @@ def test_tester_layer(self):
self.assertIn("numeric-string", config_data)
default_value = config_data['numeric-string']['default']
self.assertEqual(default_value, "0123456789", "value must be a string")
+ # Issue 218, ensure proper order of layer application
+ self.assertEqual(config_data['backup_retention_count']['default'], 7,
+ 'Config from layers was merged in wrong order')
cyaml = base / "layer.yaml"
self.assertTrue(cyaml.exists())
cyaml_data = yaml.load(cyaml.open())
- self.assertEquals(cyaml_data['includes'], ['trusty/mysql'])
+ self.assertEquals(cyaml_data['includes'], ['trusty/test-base',
+ 'trusty/mysql'])
self.assertEquals(cyaml_data['is'], 'foo')
self.assertEquals(cyaml_data['options']['trusty/mysql']['qux'], 'one')
@@ -1,3 +1,4 @@
+includes: ['trusty/test-base']
defines:
qux:
enum: ['one', 'two']
@@ -0,0 +1,5 @@
+options:
+ backup_retention_count:
+ default: 0
+ type: int
+ description: Number of recent backups to retain.

0 comments on commit f651e14

Please sign in to comment.