Avoid empty rescue block
@@ -4753,38 +4753,11 @@ HOSTS
end
end
- # Start the AppDashboard web service which allows users to login, upload
- # and remove apps, and view the status of the AppScale deployment. Other
- # nodes will need to delete the old source since we regenerate each
- # 'up'.
- def prep_app_dashboard()
- @state = "Preparing AppDashboard"
- Djinn.log_info("Preparing AppDashboard")
-
- my_public = my_node.public_ip
- my_private = my_node.private_ip
-
- # Reserve dashboard app ID.
- result = reserve_app_id(APPSCALE_USER, AppDashboard::APP_NAME,
- AppDashboard::APP_LANGUAGE, @@secret)
- Djinn.log_debug("reserve_app_id for dashboard returned: #{result}.")
-
- source_archive = AppDashboard.prep(
- my_public, my_private, PERSISTENT_MOUNT_POINT, @@secret)
-
- begin
- ZKInterface.get_version_details(
- AppDashboard::APP_NAME, DEFAULT_SERVICE, DEFAULT_VERSION)
- # If the version node exists, skip the AdminServer call.
- return
- rescue VersionNotFound
- # This is expected the first time this function is called.
- end
-
+ # Deploy the dashboard by making a request to the AdminServer.
+ def deploy_dashboard(source_archive)
# Allow fewer dashboard instances for small deployments.
min_dashboards = [3, get_all_appengine_nodes.length].min
- # Deploy the dashboard with the AdminServer.
version = {:deployment => {:zip => {:sourceUrl => source_archive}},
:id => DEFAULT_VERSION,
:instanceClass => 'F4',
@@ -4797,7 +4770,7 @@ HOSTS
}}
endpoint = ['v1', 'apps', AppDashboard::APP_NAME,
'services', DEFAULT_SERVICE, 'versions'].join('/')
- uri = URI("http://#{my_private}:#{ADMIN_SERVER_PORT}/#{endpoint}")
+ uri = URI("http://#{my_node.private_ip}:#{ADMIN_SERVER_PORT}/#{endpoint}")
headers = {'Content-Type' => 'application/json',
'AppScale-Secret' => @@secret,
'AppScale-User' => APPSCALE_USER}
@@ -4821,6 +4794,35 @@ HOSTS
end
end
+ # Start the AppDashboard web service which allows users to login, upload
+ # and remove apps, and view the status of the AppScale deployment. Other
+ # nodes will need to delete the old source since we regenerate each
+ # 'up'.
+ def prep_app_dashboard()
+ @state = "Preparing AppDashboard"
+ Djinn.log_info("Preparing AppDashboard")
+
+ my_public = my_node.public_ip
+ my_private = my_node.private_ip
+
+ # Reserve dashboard app ID.
+ result = reserve_app_id(APPSCALE_USER, AppDashboard::APP_NAME,
+ AppDashboard::APP_LANGUAGE, @@secret)
+ Djinn.log_debug("reserve_app_id for dashboard returned: #{result}.")
+
+ source_archive = AppDashboard.prep(
+ my_public, my_private, PERSISTENT_MOUNT_POINT, @@secret)
+
+ begin
+ ZKInterface.get_version_details(
+ AppDashboard::APP_NAME, DEFAULT_SERVICE, DEFAULT_VERSION)
+ # If the version node exists, skip the AdminServer call.
+ return
+ rescue VersionNotFound
+ self.deploy_dashboard(source_archive)
+ end
+ end
+
# Stop the AppDashboard web service.
def stop_app_dashboard()
Djinn.log_info("Shutting down AppDashboard")
