stemcell 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -74,14 +74,48 @@ install_chef() {
74
74
  }
75
75
 
76
76
 
77
+ update_repo() {
78
+ git_wrapper=/etc/chef/git_wrapper
79
+ local keyfile=/etc/chef/git_key
80
+ mkdir -p $(dirname $repo_dir)
81
+ if [ -d $repo_dir ]; then
82
+ echo updating source...
83
+ (cd $repo_dir && GIT_SSH=$git_wrapper git fetch && git reset --hard origin/$branch && git clean -fdx)
84
+ else
85
+ echo -e "$git_key" > $keyfile
86
+ chmod 0400 $keyfile
87
+ echo "ssh -i $keyfile -o StrictHostKeyChecking=no \$1 \$2" > $git_wrapper
88
+ chmod 0500 $git_wrapper
89
+ echo downloading cookbook repo...
90
+ GIT_SSH=$git_wrapper git clone --branch $branch --depth 1 $origin $repo_dir
91
+ fi
92
+ echo done updating code
93
+ }
94
+
95
+
77
96
  configure_chef() {
78
97
  echo configuring chef...
79
98
  mkdir -p /etc/chef
80
- cat<<EOF>/etc/chef/solo.json
99
+ if [ -f $repo_dir/roles/${branch}.rb ]; then
100
+ echo "setting runlist to role[$branch],role[$role]"
101
+ cat<<EOF>/etc/chef/solo.json
102
+ {
103
+ "run_list": [
104
+ "role[$branch]",
105
+ "role[$role]"
106
+ ],
107
+ "branch": "$branch"
108
+ }
109
+ EOF
110
+ else
111
+ echo "setting runlist to role[$role]"
112
+ cat<<EOF>/etc/chef/solo.json
81
113
  {
82
- "run_list": "role[$role]"
114
+ "run_list": "role[$role]",
115
+ "branch": "$branch"
83
116
  }
84
117
  EOF
118
+ fi
85
119
 
86
120
  cat<<EOF>/etc/chef/solo.rb
87
121
  log_level :info
@@ -96,31 +130,13 @@ EOF
96
130
  }
97
131
 
98
132
 
99
- update_repo() {
100
- git_wrapper=/etc/chef/git_wrapper
101
- local keyfile=/etc/chef/git_key
102
- if [ -d $repo_dir ]; then
103
- echo updating source...
104
- (cd $repo_dir && GIT_SSH=$git_wrapper git pull && git reset --hard && git clean -fdx)
105
- else
106
- echo -e "$git_key" > $keyfile
107
- chmod 0400 $keyfile
108
- echo "ssh -i $keyfile -o StrictHostKeyChecking=no \$1 \$2" > $git_wrapper
109
- chmod 0500 $git_wrapper
110
- echo downloading cookbook repo...
111
- GIT_SSH=$git_wrapper git clone --branch $branch --depth 1 $origin $repo_dir
112
- fi
113
- echo done updating code
114
- }
115
-
116
-
117
133
  configure_converger() {
118
134
  cat<<EOF>/usr/local/bin/converge
119
135
  #!/bin/bash -e
120
136
 
121
137
  cd $repo_dir
122
- GIT_SSH=$git_wrapper git pull
123
- git reset --hard
138
+ GIT_SSH=$git_wrapper git fetch
139
+ git reset --hard origin/$branch
124
140
  git clean -fdx
125
141
  chef-solo
126
142
  EOF
@@ -164,8 +180,8 @@ install curl
164
180
  install git
165
181
  get_instance_id
166
182
  install_chef
167
- configure_chef
168
183
  update_repo
184
+ configure_chef
169
185
  configure_converger
170
186
  run_chef
171
187
  configure_chef_daemon
@@ -1,3 +1,3 @@
1
1
  module Stemcell
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stemcell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: