zeployment 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: 04fd175b97a384f301a77312e5b7ad7e5d5e19def1561bd2a52f61513ce991e0
4
- data.tar.gz: f9c90b643491ae644998c974bad93db63c192af451c8dc9ca20dd00e5cc0dbb3
3
+ metadata.gz: a17028b39f3ea949fe18cb3cbc58924d1661a82a58bbe378d7a40f7038f51247
4
+ data.tar.gz: a7fdee6ae2bdb7bbe50fa4f7abb8e7120b73b0393d8710d3e77f0cfd15297941
5
5
  SHA512:
6
- metadata.gz: a176dab08a6ac1b7174bacfd5591522000a3823af06ebb642cab062f323deb75b24e1dc804ebd2908d139044ce8e664a03d247f0d068d78aab04e74d668a3c98
7
- data.tar.gz: 10ace35587f82a60f71d9f19baf7821af19d941cb2b6f693a8026e4ed67b1379a5f3fdfd02c182aa364e8c838346d51413dc5605a13535f187056c178ac28306
6
+ metadata.gz: 471e482be69272cf163e570b9ff39766ea83a32936990910123a160bb305dee2254bdf3757adfc44aac8a3fbcd522ef797ad13b4317689ef5e71b6a468f28dc0
7
+ data.tar.gz: c1ccfa49d5fcb86e1b8125fecfa3a66c85e0d1d0350686ca7b2c0b0be4cbfcaa1f1314b6ebcc1d8fbdc11fb7b9c9ca0227ed3446bb467d7bccd9b2c43d2ad6ea
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  .idea
10
+ lib/.byebug_history
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zeployment (0.2.0)
4
+ zeployment (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module Zeployment
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/zeployment.rb CHANGED
@@ -15,7 +15,6 @@ module Zeployment
15
15
  return JSON.parse(load_balancer_instances_description)
16
16
  end
17
17
 
18
-
19
18
  def self.get_load_balancers_instances_description_command (name_of_load_balancer)
20
19
  return "aws elb describe-instance-health --load-balancer-name #{name_of_load_balancer}"
21
20
  end
@@ -71,5 +70,30 @@ module Zeployment
71
70
  load_balancer_insrance_data_hash = get_load_balancer_particular_instance_data name_of_load_balancer, instance_id
72
71
  return load_balancer_insrance_data_hash["InstanceStates"][0]["State"] == "InService"
73
72
  end
73
+
74
+ def self.deploy (name_of_load_balancer, login_command_without_ip, commands_to_run)
75
+ instances_details = get_load_balancer_instances_description(name_of_load_balancer)
76
+ instances_details["InstanceStates"].each do |instance|
77
+ instance_id = instance["InstanceId"]
78
+ instance_ip = get_ip_address_of_ec2_from_id(instance_id)
79
+ puts instance_ip
80
+ deregister_instance_from_load_balancer(name_of_load_balancer, instance_id)
81
+ login_and_run_commands("#{login_command_without_ip}@#{instance_ip}", commands_to_run)
82
+ register_instance_with_load_balancer(name_of_load_balancer, instance_id)
83
+ wait_till_the_instance_in_service(name_of_load_balancer, instance_id)
84
+ puts ">>>>>>> Instance is in Service now <<<<<<<<<<<<<"
85
+ end
86
+ end
87
+
88
+ def self.wait_till_the_instance_in_service(name_of_load_balancer, instance_id)
89
+ while !instance_is_in_service?(name_of_load_balancer, instance_id) do
90
+ puts ">>>>>>> Instance Not in Service <<<<<<<<<<<<<"
91
+ end
92
+ end
93
+
94
+ def self.login_and_run_commands(login_command, commands_to_run)
95
+ system("#{login_command} << #{commands_to_run} ")
96
+ end
97
+
74
98
  end
75
99
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zeployment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naman Gupta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-18 00:00:00.000000000 Z
11
+ date: 2018-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler