Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: nanliu/Razor
...
head fork: sileht/Razor
Checking mergeability… Don't worry, you can still create the pull request.
  • 6 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
2  lib/project_razor/broker/puppet/agent_install.erb
@@ -62,4 +62,4 @@ function provision_puppet() {
exit 0
}
-provision_puppet
+provision_puppet 2>&1 | tee /tmp/puppet.log
View
1  lib/project_razor/model/base.rb
@@ -86,6 +86,7 @@ def fsm_action(action, method)
@current_state = fsm[@current_state][action]
else
@current_state = fsm[@current_state][:else]
+ logger.warn "State #{@current_state} is not in the fsm tree for action #{action},:else is used instead"
end
rescue => e
logger.error "FSM ERROR: #{e.message}"
View
13 lib/project_razor/model/debian.rb
@@ -112,9 +112,6 @@ def postinstall_call
when "boot"
fsm_action(:os_boot, :postinstall)
return os_complete_script(@node)
- when "source_fix"
- fsm_action(:source_fix, :postinstall)
- return
when "send_ips"
#fsm_action(:source_fix, :postinstall)
# Grab IP string
@@ -156,11 +153,13 @@ def fsm_tree
:mk_call => :postinstall,
:boot_call => :postinstall,
:preseed_end => :postinstall,
- :source_fix => :postinstall,
- :apt_get_update => :postinstall,
- :apt_get_upgrade => :postinstall,
- :apt_get_ruby => :postinstall,
:postinstall_inject => :postinstall,
+ :apt_update_ok => :postinstall,
+ :apt_update_failed => :error_catch,
+ :apt_upgrade_ok => :postinstall,
+ :apt_upgrade_failed => :error_catch,
+ :apt_install_ok => :postinstall,
+ :apt_install_failed => :error_catch,
:os_boot => :os_complete,
:post_error => :error_catch,
:post_timeout => :timeout_error,
View
32 lib/project_razor/model/debian/wheezy/os_boot.erb
@@ -1,9 +1,15 @@
#!/bin/bash
-# This is a patch for lack of DNS in my lab (Not needed if you have proper DNS, .nick)
-sed -i '4 i\
-192.168.99.50 puppet learn puppet.razor-dev.local learn.razor-dev.local' /etc/hosts
-[ "$?" -eq 0 ] && curl <%= callback_url("postinstall", "added_puppet_hosts_ok") %> || curl <%= callback_url("postinstall", "added_puppet_hosts_fail") %>
+check_status(){
+ status=$?
+ step="$1"
+ if [ "$status" -eq 0 ]; then
+ curl -silent "<%= callback_url("postinstall", "") %>"$step"_ok"
+ else
+ curl -silent "<%= callback_url("postinstall", "") %>"$step"_failed"
+ exit 1
+ fi
+}
hostname <%= hostname %>
echo <%= hostname %> > /etc/hostname
@@ -14,22 +20,17 @@ echo <%= hostname %> > /etc/hostname
# be resolved properly). A backup of the original file will be left in place
# in the /etc/hosts- file
cp -p /etc/hosts /etc/hosts-
-grep '^127\.0\.0\.1.*' /etc/hosts- > /etc/hosts
-grep -v '^127\.0\.0\.1.*' /etc/hosts- | grep '^127\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}.*' | head -1 | sed 's/^\(127\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\)\([[:blank:]]\{1,\}\)\(.*\)$/\1\2'<%= hostname %>.<%= domainname %>'\2'<%= hostname %>'/' >> /etc/hosts
-grep -v '^127\.0\.0\.1.*' /etc/hosts- | grep '^127\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}.*' | tail -n +2 >> /etc/hosts
-grep -v '^127\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}.*' /etc/hosts- >> /etc/hosts
+sed -i -e '/^127\.0\.1\.1/s/.*/127.0.1.1 <%= hostname %>.<%= domainname %> <%= hostname %>/' /etc/hosts
+check_status "set_hostname"
-[ "$?" -eq 0 ] && curl <%= callback_url("postinstall", "set_hostname_ok") %> || curl <%= callback_url("postinstall", "set_hostname_fail") %>
-
-sed -i 's_<%= config.image_svc_host %>:<%= config.image_svc_port %>/razor/image/os/<%= @image_uuid %>_archive.ubuntu.com/ubuntu_g' /etc/apt/sources.list && <%= callback_url("postinstall", "sources_fix") %>
apt-get -y update
-[ "$?" -eq 0 ] && curl <%= callback_url("postinstall", "apt_update_ok") %> || curl <%= callback_url("postinstall", "apt_update_fail") %>
+check_status "apt_update"
apt-get -y upgrade
-[ "$?" -eq 0 ] && curl <%= callback_url("postinstall", "apt_upgrade_ok") %> || curl <%= callback_url("postinstall", "apt_upgrade_fail") %>
+check_status "apt_upgrade"
-apt-get -y install rubygems facter
-[ "$?" -eq 0 ] && curl <%= callback_url("postinstall", "apt_install_ok") %> || curl <%= callback_url("postinstall", "apt_install_fail") %>
+apt-get -y install rubygems facter
+check_status "apt_install"
# Get current IP
node_ip=`facter ipaddress`
@@ -37,3 +38,4 @@ node_ip=`facter ipaddress`
curl <%= callback_url("postinstall", "send_ips") %>/$node_ip
# get final script
curl <%= callback_url("postinstall", "boot") %> | sh
+
View
2  lib/project_razor/model/debian/wheezy/preseed.erb
@@ -52,6 +52,6 @@ d-i preseed/late_command string \
wget <%= api_svc_uri %>/policy/callback/<%= policy_uuid %>/preseed/end; \
wget <%= api_svc_uri %>/policy/callback/<%= policy_uuid %>/postinstall/inject -O /target/usr/local/bin/razor_postinstall.sh; \
sed -i '/exit 0/d' /target/etc/rc.local; \
-echo bash /usr/local/bin/razor_postinstall.sh >> /target/etc/rc.local; \
+echo 'bash /usr/local/bin/razor_postinstall.sh 2>&1 | tee /tmp/razor_postinstall.log' >> /target/etc/rc.local; \
echo exit 0 >> /target/etc/rc.local; \
chmod +x /target/usr/local/bin/razor_postinstall.sh

No commit comments for this range

Something went wrong with that request. Please try again.