Skip to content

Commit

Permalink
Make ui plugin installation optional
Browse files Browse the repository at this point in the history
When multiple vic appliances are installed, we need to make
ui plugin installation optional on individual appliance,so
users can decide which ui plugin should be installed or upgraded
for later use.
  • Loading branch information
wjun committed Aug 30, 2018
1 parent 100349d commit 35238d0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
18 changes: 15 additions & 3 deletions installer/build/scripts/upgrade/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ DESTROY_ENABLED=""
MANUAL_DISK_MOVE=""
EMBEDDED_PSC=""
INSECURE_SKIP_VERIFY=""
UPGRADE_UI_PLUGIN=""

TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S %z %Z")
export REDIRECT_ENABLED=0
Expand Down Expand Up @@ -86,6 +87,7 @@ function usage {
[--embedded-psc]: Using embedded PSC. Do not prompt for external PSC options.
[--ssh-insecure-skip-verify]: Skip host key checking when SSHing to the old appliance.
[--upgrade-ui-plugin]: Upgrade ui plugin or not (y/n).
"
}

Expand Down Expand Up @@ -544,6 +546,9 @@ function main {
--ssh-insecure-skip-verify)
INSECURE_SKIP_VERIFY="1"
;;
--upgrade-ui-plugin)
UPGRADE_UI_PLUGIN="y"
;;
-h|--help|*)
usage
exit 0
Expand Down Expand Up @@ -588,6 +593,7 @@ function main {
export GOVC_DATACENTER="$VCENTER_DATACENTER"
[ -z "${APPLIANCE_TARGET}" ] && read -p "Enter old VIC appliance IP: " APPLIANCE_TARGET
[ -z "${APPLIANCE_USERNAME}" ] && read -p "Enter old VIC appliance username: " APPLIANCE_USERNAME
[ -z "${UPGRADE_UI_PLUGIN}" ] && read -p "Upgrade VIC UI Plugin? (y/n):" UPGRADE_UI_PLUGIN

if [ -n "${DESTROY_ENABLED}" ] ; then
local resp=""
Expand Down Expand Up @@ -632,8 +638,10 @@ function main {
### -------------------- ###
### Component Upgrades ###
### -------------------- ###
log "\n-------------------------\nStarting VIC UI Plugin Upgrade ${TIMESTAMP}\n"
upgradeAppliancePlugin
if [ "$UPGRADE_UI_PLUGIN" == "y" ]; then
log "\n-------------------------\nStarting VIC UI Plugin Upgrade ${TIMESTAMP}\n"
upgradeAppliancePlugin
fi

log "\n-------------------------\nStarting Admiral Upgrade ${TIMESTAMP}\n"
upgradeAdmiral
Expand Down Expand Up @@ -664,7 +672,11 @@ function finish() {
if [ "$rc" -eq 0 ]; then
log ""
log "-------------------------"
log "Upgrade completed successfully. Exiting."
if [ "$UPGRADE_UI_PLUGIN" == "y" ]; then
log "Upgrade completed successfully. Exiting. All vSphere Client users must log out and log back in again twice to see the vSphere Integrated Containers plug-in."
else
log "Upgrade completed successfully. Exiting."
fi
log "-------------------------"
log ""
else
Expand Down
3 changes: 2 additions & 1 deletion installer/fileserver/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ <h4>Infrastructure Deployment Tools</h4>
<div class="modal-dialog" role="dialog"aria-hidden="false">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Complete VIC plugin installation</h3>
<h3 class="modal-title">Complete VIC appliance installation</h3>
</div>
<div id="plugin-spinner" style="display: none;text-align: center">
<div class="spinner"></div>
Expand Down Expand Up @@ -229,6 +229,7 @@ <h3 class="modal-title">Complete VIC appliance installation</h3>
<label for="pscDomain">External PSC Admin Domain</label>
<input id="pscDomain" type="text" name="pscDomain" placeholder="vsphere.local">
</div>
Install UI Plugin <input id="needuiplugin" type="checkbox" name="needuiplugin" value="true" checked>
<input id="thumbprint" type="hidden" name="thumbprint" placeholder="">
</div>
<div class="text-sm-right">
Expand Down
22 changes: 13 additions & 9 deletions installer/fileserver/routes/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func (i *IndexHTMLRenderer) IndexHandler(resp http.ResponseWriter, req *http.Req
if err := indexFormHandler(op, req, html); err != nil {
op.Errorf("Install failed: %s", err.Error())
html.InitErrorFeedback = fmt.Sprintf("Installation failed: %s", err.Error())
} else if req.FormValue("needuiplugin") == "true" {
html.InitSuccessFeedback = "Installation successful. Refer to the Post-install and Deployment tasks below. All vSphere Client users must log out and log back in again twice to see the vSphere Integrated Containers plug-in."
} else {
html.InitSuccessFeedback = "Installation successful. Refer to the Post-install and Deployment tasks below."
}
Expand Down Expand Up @@ -99,16 +101,18 @@ func indexFormHandler(op trace.Operation, req *http.Request, html *IndexHTMLOpti
return err
}

h5 := tasks.NewH5UIPlugin(PSCConfig.Admin)
h5.Force = true
if err := h5.Install(op); err != nil {
return err
}
if req.FormValue("needuiplugin") == "true" {
h5 := tasks.NewH5UIPlugin(PSCConfig.Admin)
h5.Force = true
if err := h5.Install(op); err != nil {
return err
}

flex := tasks.NewFlexUIPlugin(PSCConfig.Admin)
flex.Force = true
if err := flex.Install(op); err != nil {
return err
flex := tasks.NewFlexUIPlugin(PSCConfig.Admin)
flex.Force = true
if err := flex.Install(op); err != nil {
return err
}
}

return nil
Expand Down
5 changes: 2 additions & 3 deletions installer/fileserver/tasks/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ func (p *Plugin) Install(op trace.Operation) error {
}
vCenterVersion := p.Target.Session.Client.ServiceContent.About.Version
if p.denyInstall(op, vCenterVersion) {
err := errors.Errorf("Refusing to install Flex plugin on vSphere %s", vCenterVersion)
op.Error(err)
return err
op.Warnf("Refusing to install Flex plugin on vSphere %s", vCenterVersion)
return nil
}

op.Infof("### Installing UI Plugin against vSphere %s ####", vCenterVersion)
Expand Down

0 comments on commit 35238d0

Please sign in to comment.