cocina 0.2.2 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f40fd78e9dae58f0388b9b0993946090d78fb8af
4
- data.tar.gz: bc60df50ce81f0e0fba66ab3e933c5db3b5e4417
3
+ metadata.gz: 715bfcc8618ced9fd9edf157b0b1b4f232d7c886
4
+ data.tar.gz: 7db61b657b81c28226aaf259a0b52b5201aa21d1
5
5
  SHA512:
6
- metadata.gz: 83bbfd7ca76d2f7102831c8f1f2f0f9a08489bef17173f824f324b4d25f8a29d6420f64103f517f59b26c8fd7de28fa0edc53a5eae125cae59955c8695139d2a
7
- data.tar.gz: 100706d0df4bf3389a355cdb1157af164d3317781c70568bb9d62d1262a43864544653b8b8223fb43da768f5ae30c4cffc83038cf0104bd2cd18722793d3699d
6
+ metadata.gz: a156c86ed880c765ce17028b6b54d186dbc5c95811e4e72670b03cb32479b72f5320acd8eb912f1a47ae7cc6244c629804b9686cbf0bc8d05010ba86d7cc5649
7
+ data.tar.gz: adecbb0b3849a7272107e0b409fbeafafa0efe94a7f59d825903a1112fb36fa7e81393f334a1caf200708d6c11090a708ad18ba77aa9b831ef8067195e56d8f9
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
  /tmp/
10
10
  .kitchen/
11
11
  .kitchen.local.yml
12
+ .cocina.kitchen.yml
13
+ Berksfile.lock
@@ -0,0 +1,28 @@
1
+ # Change Log
2
+
3
+ ## [v0.3.0](https://github.com/brandocorp/cocina/tree/v0.3.0) (2016-01-07)
4
+ [Full Changelog](https://github.com/brandocorp/cocina/compare/v0.2.2...v0.3.0)
5
+
6
+ **Merged pull requests:**
7
+
8
+ - add address DSL [\#2](https://github.com/brandocorp/cocina/pull/2) ([brandocorp](https://github.com/brandocorp))
9
+
10
+ ## [v0.2.2](https://github.com/brandocorp/cocina/tree/v0.2.2) (2016-01-05)
11
+ [Full Changelog](https://github.com/brandocorp/cocina/compare/v0.2.0...v0.2.2)
12
+
13
+ ## [v0.2.0](https://github.com/brandocorp/cocina/tree/v0.2.0) (2015-12-30)
14
+ [Full Changelog](https://github.com/brandocorp/cocina/compare/v0.1.3...v0.2.0)
15
+
16
+ ## [v0.1.3](https://github.com/brandocorp/cocina/tree/v0.1.3) (2015-12-29)
17
+ [Full Changelog](https://github.com/brandocorp/cocina/compare/v0.1.2...v0.1.3)
18
+
19
+ ## [v0.1.2](https://github.com/brandocorp/cocina/tree/v0.1.2) (2015-12-29)
20
+ [Full Changelog](https://github.com/brandocorp/cocina/compare/v0.1.1...v0.1.2)
21
+
22
+ ## [v0.1.1](https://github.com/brandocorp/cocina/tree/v0.1.1) (2015-12-26)
23
+ [Full Changelog](https://github.com/brandocorp/cocina/compare/v0.1.0...v0.1.1)
24
+
25
+ ## [v0.1.0](https://github.com/brandocorp/cocina/tree/v0.1.0) (2015-12-25)
26
+
27
+
28
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
@@ -11,17 +11,11 @@ platforms:
11
11
 
12
12
  suites:
13
13
  - name: db
14
- driver:
15
- network:
16
- - ["private_network", ip: "10.11.11.10"]
17
14
  run_list:
18
15
  - counter_redis::default
19
16
  attributes:
20
17
 
21
18
  - name: app
22
- driver:
23
- network:
24
- - ["private_network", ip: "10.11.11.11"]
25
19
  run_list:
26
20
  - counter_app::default
27
21
  attributes:
@@ -29,9 +23,6 @@ suites:
29
23
  redis_host: "10.11.11.10"
30
24
 
31
25
  - name: web
32
- driver:
33
- network:
34
- - ["private_network", ip: "10.11.11.12"]
35
26
  run_list:
36
27
  - counter_nginx::default
37
28
  attributes:
@@ -4,11 +4,18 @@ log_level :info
4
4
  instance 'web-ubuntu-1404' do
5
5
  depends 'app-ubuntu-1404'
6
6
  actions :converge, :converge, :verify
7
+ address "10.11.11.12"
7
8
  cleanup true
8
9
  end
9
10
 
10
11
  instance 'app-ubuntu-1404' do
11
12
  depends 'db-ubuntu-1404'
12
13
  actions :converge, :converge, :verify
14
+ address "10.11.11.11"
13
15
  cleanup true
14
16
  end
17
+
18
+ instance 'db-ubuntu-1404' do
19
+ address "10.11.11.10"
20
+ actions :create
21
+ end
@@ -24,13 +24,13 @@ module Cocina
24
24
  def load_kitchen_config
25
25
  @loader = Kitchen::Loader::YAML.new(
26
26
  project_config: project_kitchen_yaml,
27
- local_config: ENV["KITCHEN_LOCAL_YAML"],
27
+ local_config: local_kitchen_yaml,
28
28
  global_config: ENV["KITCHEN_GLOBAL_YAML"]
29
29
  )
30
30
  @config = Kitchen::Config.new(
31
- loader: @loader
31
+ loader: @loader,
32
+ log_level: log_level
32
33
  )
33
- @config.log_level = log_level
34
34
  @config.log_overwrite =
35
35
  Kitchen.env_log_overwrite unless Kitchen.env_log_overwrite.nil?
36
36
  end
@@ -40,6 +40,7 @@ module Cocina
40
40
  @log_level = level
41
41
  end
42
42
 
43
+ # DSL to override the base .kitchen.yml file
43
44
  def with_kitchen_yaml(file)
44
45
  @project_kitchen_yaml = file
45
46
  end
@@ -48,6 +49,10 @@ module Cocina
48
49
  @project_kitchen_yaml ||= ENV["KITCHEN_YAML"]
49
50
  end
50
51
 
52
+ def local_kitchen_yaml
53
+ ENV["KITCHEN_LOCAL_YAML"]
54
+ end
55
+
51
56
  def kitchen_instance(target)
52
57
  @config.instances.get(target)
53
58
  end
@@ -55,7 +60,7 @@ module Cocina
55
60
  def instance(id, &block)
56
61
  return true if instance?(id)
57
62
  cocina_instance = Cocina::Instance.new(id)
58
- cocina_instance.instance_eval(&block)
63
+ cocina_instance.instance_eval(&block) if block
59
64
  @instances << cocina_instance
60
65
  nil
61
66
  end
@@ -5,7 +5,7 @@ module Cocina
5
5
  class Instance
6
6
  extend Forwardable
7
7
 
8
- attr_reader :name, :dependencies, :actions
8
+ attr_reader :name, :dependencies, :actions, :addresses
9
9
  attr_accessor :runner
10
10
 
11
11
  def_delegators :@runner, :destroy, :create, :converge, :verify
@@ -13,6 +13,7 @@ module Cocina
13
13
  def initialize(name)
14
14
  @name = name
15
15
  @dependencies = []
16
+ @addresses = []
16
17
  @actions = default_actions
17
18
  @cleanup = false
18
19
  end
@@ -41,6 +42,16 @@ module Cocina
41
42
  dependencies.empty? ? false : true
42
43
  end
43
44
 
45
+ # Define a network address for the instance
46
+ def address(ip)
47
+ @addresses << case ip
48
+ when :dhcp
49
+ ['private_network', {type: "dhcp"}]
50
+ else
51
+ ['private_network', {ip: ip}]
52
+ end
53
+ end
54
+
44
55
  # Set or return the list of actions
45
56
  #
46
57
  def actions(*list)
@@ -57,12 +68,17 @@ module Cocina
57
68
  # Run all actions defined for the Instance
58
69
  #
59
70
  def run_actions
71
+ # Override instance addresses before creating
72
+ override_addresses
60
73
  actions.each do |action|
61
- # execute perform.before
62
74
  send action
63
75
  end
64
76
  end
65
77
 
78
+ def suite
79
+ name.scan(/([\w-]+)-(\w*)-(\w*)/).flatten.first
80
+ end
81
+
66
82
  private
67
83
 
68
84
  def default_actions
@@ -75,6 +91,10 @@ module Cocina
75
91
  @runner.last_action
76
92
  end
77
93
 
94
+ def override_addresses
95
+ runner.driver.instance_eval { @config[:network] = addresses }
96
+ end
97
+
78
98
  # def execute(*cmds)
79
99
  # cmds.each {|cmd| @runner.remote_exec(cmd) }
80
100
  # end
@@ -1,3 +1,3 @@
1
1
  module Cocina
2
- VERSION = "0.2.2"
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocina
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Raabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-05 00:00:00.000000000 Z
11
+ date: 2016-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -123,6 +123,7 @@ files:
123
123
  - ".ruby-gemset"
124
124
  - ".ruby-version"
125
125
  - ".travis.yml"
126
+ - CHANGELOG.md
126
127
  - Gemfile
127
128
  - LICENSE.txt
128
129
  - README.md