chapp 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df5a3ee559314be541400ce3f160eb2249a3eb33
4
- data.tar.gz: c30c0a7a36926f19790ae97662f8f1994b436c7c
3
+ metadata.gz: c248d2e06794fd78569bb13df69a0405d2e156fc
4
+ data.tar.gz: 6273136e426fd9a05b941b6693057e4ecbb3e733
5
5
  SHA512:
6
- metadata.gz: 7ffa4a00648cd946eae3a84c5261e29fb794af24dee1f6cd98bf883c17ac8972f61d5c4afb728beab8979982c93d6307b503e9d311c82b9a15ab30500e9be6d7
7
- data.tar.gz: 85952443b0773e367700db08ef5eb1c6e8f4c113b22f7ea3b8fb122384e23b0d71472002f73c94c3f05a788b5edf7aebd15661c6457c04c90a790f009aad1651
6
+ metadata.gz: 7d3bac46993def58aab672bc35107e95b87580152b451439d344eee713aaed02ec4b441664181d6d0c4b5195f076f028c5fad331d1412dbbfbfed9bc380c6d29
7
+ data.tar.gz: d9f4baeda30730a9555f194d15f1a73401d92eab4b234fa5da43af8c86fdbf7ec1e3f8a580760dfe1c12f0eb218d25c4c54ecf43cbfa330f3eb8ac9d65a9cab3
data/lib/chapp.rb CHANGED
@@ -4,17 +4,17 @@ require 'chapp/app_config'
4
4
  require 'chapp/wiring'
5
5
  require 'chapp/database'
6
6
  require 'chapp/provisioner'
7
- require 'chapp/provisioner/ec2_provisioner'
7
+ require 'chapp/provisioner/property_provisioner'
8
8
 
9
9
  module Chapp
10
-
10
+
11
11
  def self.database
12
12
  Chapp::Database.new
13
13
  end
14
-
14
+
15
15
  def self.provisioner
16
16
  # TODO: Make configurable
17
- Chapp::EC2Provisioner.new
17
+ Chapp::PropertyProvisioner.new
18
18
  end
19
-
20
- end
19
+
20
+ end
@@ -4,32 +4,32 @@ require 'chapp'
4
4
  class Chef
5
5
  class Knife
6
6
  class AppUpload < Chef::Knife
7
-
7
+
8
8
  banner "knife app upload app_file (options)"
9
9
  category "app"
10
-
10
+
11
11
  # This method will be executed when you run this knife command.
12
12
  def run
13
-
13
+
14
14
  # Get Arguments
15
15
  if @name_args.size != 1
16
16
  ui.info("Please specify an app_file")
17
17
  show_usage
18
18
  exit 1
19
19
  end
20
-
20
+
21
21
  app_config_file = @name_args[0]
22
-
22
+
23
23
  # Build app config from file
24
24
  app_config = Chapp::AppConfig.from_file app_config_file
25
-
25
+
26
26
  # Write the app config
27
27
  Chapp.database.write_app_config app_config
28
-
29
- puts "Uploaded app [#{app_config.id}]"
28
+
29
+ puts "Uploaded app [#{app_config.id_hash}]"
30
30
  end
31
-
32
-
31
+
32
+
33
33
  end
34
34
  end
35
- end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Baugher
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '11.0'
27
- - !ruby/object:Gem::Dependency
28
- name: aws-sdk
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: '1.47'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '1.47'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: chef-metal
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,7 +78,6 @@ files:
92
78
  - lib/chapp/app_config.rb
93
79
  - lib/chapp/app_instance.rb
94
80
  - lib/chapp/database.rb
95
- - lib/chapp/provisioner/ec2_provisioner.rb
96
81
  - lib/chapp/provisioner/property_provisioner.rb
97
82
  - lib/chapp/provisioner.rb
98
83
  - lib/chapp/wiring.rb
@@ -1,73 +0,0 @@
1
- require 'chapp'
2
- require 'aws-sdk'
3
- require 'chef_metal/transport/ssh'
4
-
5
- module Chapp
6
- class EC2Provisioner < Chapp::Provisioner
7
-
8
- # Knife config
9
- ACCESS_KEY = "ec2_access_key_id"
10
- SECRET_KEY = "ec2_secret_access_key"
11
- KEY_PAIR = "ec2_key_pair"
12
-
13
- # App config
14
- IMAGE_ID = "image_id"
15
- INSTANCE_TYPE = "instance_type"
16
-
17
- def build_server app_config, properties
18
-
19
- errors = []
20
-
21
- access_key = Chef::Config[ACCESS_KEY]
22
- secret_key = Chef::Config[SECRET_KEY]
23
- key_pair = Chef::Config[KEY_PAIR]
24
-
25
- if access_key.nil?
26
- errors << "#{ACCESS_KEY} must be specified in your knife config"
27
- end
28
-
29
- if secret_key.nil?
30
- errors << "#{SECRET_KEY} must be specified in your knife config"
31
- end
32
-
33
- if key_pair.nil?
34
- errors << "#{KEY_PAIR} must be specified in your knife config"
35
- end
36
-
37
- unless app_config.cloud.has_key? IMAGE_ID
38
- errors << "#{IMAGE_ID} must be specified in your app's cloud config"
39
- end
40
-
41
- unless app_config.cloud.has_key? INSTANCE_TYPE
42
- errors << "#{INSTANCE_TYPE} must be specified in your app's cloud config"
43
- end
44
-
45
- image_id = app_config.cloud[IMAGE_ID]
46
- instance_type = app_config.cloud[INSTANCE_TYPE]
47
-
48
- ec2 = AWS::EC2.new(:access_key_id => access_key, :secret_access_key => secret_key)
49
-
50
- instance = ec2.instances.create(
51
- :image_id => image_id,
52
- :instance_type => instance_type,
53
- :key_pair => ec2.key_pairs[key_pair]
54
- )
55
-
56
- puts "Waiting for new instance with id #{instance.id} to become available..."
57
- sleep 1 while instance.status == :pending
58
-
59
- puts "#{instance.dns_name} is ready"
60
- puts "Waiting for host to finish booting ..."
61
-
62
- # TODO: Wait for SSH to become available
63
- ssh = ChefMetal::Transport::SSH.new instance.dns_name, "root", {:keys => [Chef::Config[:knife][:identity_file]]}, {}, {}
64
-
65
- while !ssh.available?
66
- sleep 5
67
- end
68
-
69
- instance.dns_name
70
- end
71
-
72
- end
73
- end