forger 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile.lock +19 -19
  4. data/docs/example/app/scripts/hello.sh +1 -1
  5. data/docs/example/app/user_data/bootstrap.sh +1 -1
  6. data/lib/forger/script/templates/ami_creation.sh +5 -1
  7. data/lib/forger/script/templates/auto_terminate.sh +5 -1
  8. data/lib/forger/script/templates/auto_terminate_after_timeout.sh +5 -1
  9. data/lib/forger/script/templates/cloudwatch.sh +5 -1
  10. data/lib/forger/script/templates/extract_forger_scripts.sh +3 -1
  11. data/lib/forger/script/upload.rb +6 -5
  12. data/lib/forger/scripts/auto_terminate.sh +1 -1
  13. data/lib/forger/scripts/auto_terminate/after_timeout.sh +1 -1
  14. data/lib/forger/scripts/auto_terminate/functions.sh +1 -1
  15. data/lib/forger/scripts/auto_terminate/functions/amzn.sh +1 -1
  16. data/lib/forger/scripts/auto_terminate/functions/amzn2.sh +1 -1
  17. data/lib/forger/scripts/auto_terminate/functions/ubuntu.sh +1 -1
  18. data/lib/forger/scripts/auto_terminate/setup.sh +1 -1
  19. data/lib/forger/scripts/cloudwatch.sh +1 -1
  20. data/lib/forger/scripts/cloudwatch/configure.sh +1 -1
  21. data/lib/forger/scripts/cloudwatch/install.sh +1 -1
  22. data/lib/forger/scripts/cloudwatch/install/amzn.sh +1 -1
  23. data/lib/forger/scripts/cloudwatch/install/amzn2.sh +1 -1
  24. data/lib/forger/scripts/cloudwatch/install/ubuntu.sh +1 -1
  25. data/lib/forger/scripts/cloudwatch/service.sh +1 -1
  26. data/lib/forger/scripts/cloudwatch/service/amzn.sh +1 -1
  27. data/lib/forger/scripts/cloudwatch/service/amzn2.sh +1 -1
  28. data/lib/forger/scripts/cloudwatch/service/ubuntu.sh +1 -1
  29. data/lib/forger/scripts/shared/functions.sh +1 -1
  30. data/lib/forger/version.rb +1 -1
  31. data/lib/templates/default/app/scripts/install/common.sh +1 -1
  32. data/lib/templates/default/app/scripts/personalize/tung.sh +1 -1
  33. data/lib/templates/default/app/user_data/layouts/default.sh.tt +1 -1
  34. data/spec/fixtures/demo_project/app/user_data/bootstrap.sh +1 -1
  35. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 833f4ee033176e828f5a04b0fd2fce2544a335113156304db55d24c3b35f2427
4
- data.tar.gz: e75cf80f65bead5108455185132b1a03de4ce5421349a0eb7c5bbd7c572afeba
3
+ metadata.gz: 6551f0c2a373f261855464a53423a8857597d5defde345906c85d6bad2bb9a25
4
+ data.tar.gz: b9e2d641ffd5ecb2c2c738f344457f5206a0b135b4651db524cbfccaf42ae594
5
5
  SHA512:
6
- metadata.gz: 4114553f5e2cc98fd4d7dae6409652ad03fa16cf49f9c658974b164b8146233a974359f2466cdcb9da05b776580dc8243be87557173acd31f93ba0eedacf07de
7
- data.tar.gz: 99905c00a84d3ae79e2155044e40024d98acbd684438f7a4f4597b298810d427b385026d3c326e281a97c63f239b778ea95366c22cc33e8b798a8c5fa376025d
6
+ metadata.gz: 1285b67f2407a48b432f8da375e32ec78bdad5b376ae3ddd5895d54700102df5a2f41a8fbe33cc989c32fb0e0af498ef4d0fe85f3b29209af75e2190d3bbb01f
7
+ data.tar.gz: 900c2a261d3db83789abdac6587b09b9ce57bb2cff977cebf48acf9e082934861d8844a9911893da5a498080c9b7dc09b5198fcc66e299d39c369ed1da742993
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [2.0.3]
7
+ - fix noop option for s3 upload
8
+ - remove -eux bash flags to quiet scripts
9
+
6
10
  ## [2.0.2]
7
11
  - Merge pull request #14 from tongueroo/fixes
8
12
  - allow cloudwatch support for amzn ami
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- forger (2.0.2)
4
+ forger (2.0.3)
5
5
  activesupport
6
6
  aws-sdk-ec2
7
7
  aws-sdk-s3
@@ -16,39 +16,39 @@ PATH
16
16
  GEM
17
17
  remote: https://rubygems.org/
18
18
  specs:
19
- activesupport (5.2.1)
19
+ activesupport (5.2.2)
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
21
  i18n (>= 0.7, < 2)
22
22
  minitest (~> 5.1)
23
23
  tzinfo (~> 1.1)
24
24
  aws-eventstream (1.0.1)
25
- aws-partitions (1.106.0)
26
- aws-sdk-core (3.35.0)
25
+ aws-partitions (1.123.0)
26
+ aws-sdk-core (3.44.0)
27
27
  aws-eventstream (~> 1.0)
28
28
  aws-partitions (~> 1.0)
29
29
  aws-sigv4 (~> 1.0)
30
30
  jmespath (~> 1.0)
31
- aws-sdk-ec2 (1.54.0)
32
- aws-sdk-core (~> 3, >= 3.26.0)
31
+ aws-sdk-ec2 (1.63.0)
32
+ aws-sdk-core (~> 3, >= 3.39.0)
33
33
  aws-sigv4 (~> 1.0)
34
- aws-sdk-kms (1.11.0)
35
- aws-sdk-core (~> 3, >= 3.26.0)
34
+ aws-sdk-kms (1.13.0)
35
+ aws-sdk-core (~> 3, >= 3.39.0)
36
36
  aws-sigv4 (~> 1.0)
37
- aws-sdk-s3 (1.23.0)
38
- aws-sdk-core (~> 3, >= 3.26.0)
37
+ aws-sdk-s3 (1.30.0)
38
+ aws-sdk-core (~> 3, >= 3.39.0)
39
39
  aws-sdk-kms (~> 1)
40
40
  aws-sigv4 (~> 1.0)
41
41
  aws-sigv4 (1.0.3)
42
42
  byebug (10.0.2)
43
43
  coderay (1.1.2)
44
44
  colorize (0.8.1)
45
- concurrent-ruby (1.0.5)
45
+ concurrent-ruby (1.1.3)
46
46
  diff-lcs (1.3)
47
47
  dotenv (2.5.0)
48
48
  ffi (1.9.25)
49
49
  filesize (0.2.0)
50
50
  formatador (0.2.5)
51
- guard (2.14.2)
51
+ guard (2.15.0)
52
52
  formatador (>= 0.2.4)
53
53
  listen (>= 2.7, < 4.0)
54
54
  lumberjack (>= 1.0.12, < 2.0)
@@ -67,7 +67,7 @@ GEM
67
67
  guard-compat (~> 1.1)
68
68
  rspec (>= 2.99.0, < 4.0)
69
69
  hashie (3.6.0)
70
- i18n (1.1.1)
70
+ i18n (1.2.0)
71
71
  concurrent-ruby (~> 1.0)
72
72
  jmespath (1.4.0)
73
73
  listen (3.1.5)
@@ -76,16 +76,16 @@ GEM
76
76
  ruby_dep (~> 1.2)
77
77
  lumberjack (1.0.13)
78
78
  memoist (0.16.0)
79
- method_source (0.9.0)
79
+ method_source (0.9.2)
80
80
  minitest (5.11.3)
81
81
  nenv (0.3.0)
82
82
  notiffany (0.1.1)
83
83
  nenv (~> 0.1)
84
84
  shellany (~> 0.0)
85
- pry (0.11.3)
85
+ pry (0.12.2)
86
86
  coderay (~> 1.1.0)
87
87
  method_source (~> 0.9.0)
88
- rake (12.3.1)
88
+ rake (12.3.2)
89
89
  rb-fsevent (0.10.3)
90
90
  rb-inotify (0.9.10)
91
91
  ffi (>= 0.5.0, < 2)
@@ -108,9 +108,9 @@ GEM
108
108
  rspec-support (3.8.0)
109
109
  ruby_dep (1.5.0)
110
110
  shellany (0.0.1)
111
- thor (0.20.0)
111
+ thor (0.20.3)
112
112
  thread_safe (0.3.6)
113
- tilt (2.0.8)
113
+ tilt (2.0.9)
114
114
  tzinfo (1.2.5)
115
115
  thread_safe (~> 0.1)
116
116
 
@@ -127,4 +127,4 @@ DEPENDENCIES
127
127
  rake
128
128
 
129
129
  BUNDLED WITH
130
- 1.16.3
130
+ 1.17.1
@@ -1,3 +1,3 @@
1
- #!/bin/bash -exu
1
+ #!/bin/bash
2
2
 
3
3
  echo "hello world"
@@ -1,4 +1,4 @@
1
- #!/bin/bash -exu
1
+ #!/bin/bash
2
2
 
3
3
  export HOME=/root # user-data env runs in weird shell where user is root but HOME is not set
4
4
 
@@ -1,4 +1,6 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
+
3
+ set -e
2
4
 
3
5
  # Create AMI Bundle
4
6
  AMI_NAME="<%= @ami_name %>"
@@ -10,3 +12,5 @@ SOURCE_AMI_ID=$(wget -q -O - http://169.254.169.254/latest/meta-data/ami-id)
10
12
  echo "$SOURCE_AMI_ID" > /var/log/source-ami-id.txt
11
13
  mkdir -p /opt/forger/data
12
14
  aws ec2 create-image --name "$AMI_NAME" --instance-id "$INSTANCE_ID" --region "$REGION" > /opt/forger/data/ami-id.txt
15
+
16
+ set +e
@@ -1,4 +1,6 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
+
3
+ set -e
2
4
 
3
5
  /opt/forger/auto_terminate/setup.sh
4
6
 
@@ -9,3 +11,5 @@
9
11
  /opt/forger/auto_terminate.sh now # terminate immediately
10
12
  <% end -%>
11
13
  <% end -%>
14
+
15
+ set +e
@@ -1,5 +1,9 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
+
3
+ set -e
2
4
 
3
5
  /opt/forger/auto_terminate/setup.sh
4
6
 
5
7
  /opt/forger/auto_terminate.sh after_timeout
8
+
9
+ set +e
@@ -1,3 +1,7 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
+
3
+ set -e
2
4
 
3
5
  /opt/forger/cloudwatch.sh forger # forger will be the cloudwatch log group name
6
+
7
+ set +e
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
 
3
3
  # extract forger happens very early and the top of the user data script.
4
4
  # Set the -e flag here to stop the script if there any errors.
@@ -70,3 +70,5 @@ function extract_forger_scripts() {
70
70
  }
71
71
 
72
72
  extract_forger_scripts
73
+
74
+ set +e
@@ -22,14 +22,15 @@ class Forger::Script
22
22
  end
23
23
 
24
24
  def upload(tarball_path)
25
- puts "Uploading scripts.tgz (#{filesize}) to #{s3_dest}".colorize(:green)
26
- obj = s3_resource.bucket(bucket_name).object(key)
27
- start_time = Time.now
28
25
  if @options[:noop]
29
26
  puts "NOOP: Not uploading file to s3"
30
- else
31
- upload_to_s3(obj, tarball_path)
27
+ return
32
28
  end
29
+
30
+ puts "Uploading scripts.tgz (#{filesize}) to #{s3_dest}".colorize(:green)
31
+ obj = s3_resource.bucket(bucket_name).object(key)
32
+ start_time = Time.now
33
+ upload_to_s3(obj, tarball_path)
33
34
  time_took = pretty_time(Time.now-start_time).colorize(:green)
34
35
  puts "Time to upload code to s3: #{time_took}"
35
36
  end
@@ -1,4 +1,4 @@
1
- #!/bin/bash -exu
1
+ #!/bin/bash
2
2
 
3
3
  if [ $# -eq 0 ]; then
4
4
  command=$(basename "$0")
@@ -1,4 +1,4 @@
1
- #!/bin/bash -exu
1
+ #!/bin/bash
2
2
 
3
3
  # This is another copy the /opt/forger/auto_terminate.sh script because the
4
4
  # /opt/forger/auto_terminate.sh also gets removed when it gets called. Specifically,
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
 
3
3
  # Key is that instance will not be terminated if source image is the same as the
4
4
  # original image id.
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
  function schedule_termination() {
3
3
  chmod +x /etc/rc.d/rc.local
4
4
  echo "/opt/forger/auto_terminate.sh after_ami >> /var/log/auto-terminate.log 2>&1" >> /etc/rc.d/rc.local
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
  function schedule_termination() {
3
3
  chmod +x /etc/rc.d/rc.local
4
4
  echo "/opt/forger/auto_terminate.sh after_ami >> /var/log/auto-terminate.log 2>&1" >> /etc/rc.d/rc.local
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
  function schedule_termination() {
3
3
  chmod +x /etc/rc.local
4
4
  sed -i 's/exit 0//' /etc/rc.local
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
  function install_jq() {
3
3
  if ! type jq > /dev/null ; then
4
4
  wget "https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64"
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
 
3
3
  if [ $# -eq 0 ]; then
4
4
  command=$(basename "$0")
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
 
3
3
  if [ $# -eq 0 ]; then
4
4
  command=$(basename "$0")
@@ -1,3 +1,3 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
 
3
3
  /opt/forger/cloudwatch/install/"$OS".sh
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
 
3
3
  # Install awslogs and the jq JSON parser
4
4
  yum install -y awslogs jq
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
 
3
3
  # Install awslogs and the jq JSON parser
4
4
  yum install -y awslogs jq
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
 
3
3
  # https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html
4
4
 
@@ -1,3 +1,3 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
 
3
3
  /opt/forger/cloudwatch/service/"$OS".sh
@@ -1,4 +1,4 @@
1
- #!/bin/bash -exu
1
+ #!/bin/bash
2
2
 
3
3
  cat > /etc/init/awslogs.conf <<- EOL
4
4
  #upstart-job
@@ -1,4 +1,4 @@
1
- #!/bin/bash -exu
1
+ #!/bin/bash
2
2
 
3
3
  # yum install already has configured
4
4
  # /usr/lib/systemd/system/awslogsd.service
@@ -1,4 +1,4 @@
1
- #/bin/bash -exu
1
+ #/bin/bash
2
2
 
3
3
  # The awslogs-agent-setup.py setup creates a systemd unit is called awslogs.
4
4
  systemctl daemon-reload
@@ -1,4 +1,4 @@
1
- #!/bin/bash -eux
1
+ #!/bin/bash
2
2
 
3
3
  function configure_aws_cli() {
4
4
  local home_dir
@@ -1,3 +1,3 @@
1
1
  module Forger
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
@@ -1,4 +1,4 @@
1
- #!/bin/bash -exu
1
+ #!/bin/bash
2
2
 
3
3
  # https://forums.aws.amazon.com/thread.jspa?threadID=270511
4
4
  (
@@ -1,3 +1,3 @@
1
- #!/bin/bash -exu
1
+ #!/bin/bash
2
2
 
3
3
  yum install htop -y
@@ -1,4 +1,4 @@
1
- #!/bin/bash -exu
1
+ #!/bin/bash
2
2
 
3
3
  export HOME=/root # In user-data env USER=root but HOME is not set
4
4
  cd ~ # user-data starts off in / so go to $HOME
@@ -1,4 +1,4 @@
1
- #!/bin/bash -exu
1
+ #!/bin/bash
2
2
 
3
3
  # test env variables from config/[ENV].yml file
4
4
  # test_key: <%= config["test_key"] %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2018-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport