Skip to content

Commit

Permalink
[VCDA-789] Refactor CSE Installation - template creation (#148)
Browse files Browse the repository at this point in the history
Created general use functions in utils.py. Functions in
config.py are specific to either CSE installation or config
file processing.

Split up template creation phase into independent functions.
create_template() handles '--update' option, and decides when
to create vapp, customize vapp, capture vapp, and delete vapp.

create_temp_vapp() handles the temp vapp creation and
customization phase of CSE installation. This function calls
create_vapp_from_config() and customize_vm().

create_vapp_from_config() initializes the vapp specifically for
CSE installation, using the initialization script.

customize_vm() customizes the vapp's vm using the customization
script.

capture_vapp_to_template() captures the vapp as a vapp template
to vcd catalog.

Simplified control flow and exception handling.

Fixed --update option to now properly delete previous CSE entities
(template, ova files, vapps)

Moved hard-coded values to constant module-level values.

Added descriptive console output in appropriate areas, and
created docstrings for each function.

Tested CSE install extensively. '--update' works properly,
resulting vapps and VMs can be ssh'd into, and all customization
finishes as expected.
  • Loading branch information
andrew-ni committed Nov 16, 2018
1 parent acebe64 commit 397708e
Show file tree
Hide file tree
Showing 4 changed files with 605 additions and 350 deletions.
7 changes: 5 additions & 2 deletions container_service_extension/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from container_service_extension.cluster import TYPE_MASTER
from container_service_extension.cluster import TYPE_NFS
from container_service_extension.cluster import TYPE_NODE
from container_service_extension.utils import SYSTEM_ORG_NAME

from container_service_extension.exceptions import ClusterOperationError
from container_service_extension.exceptions import ClusterInitializationError
Expand Down Expand Up @@ -115,8 +116,10 @@ def _connect_sysadmin(self):
verify_ssl_certs=self.verify,
log_headers=True,
log_bodies=True)
self.client_sysadmin.set_credentials(
BasicLoginCredentials(self.username, 'System', self.password))
credentials = BasicLoginCredentials(self.username,
SYSTEM_ORG_NAME,
self.password)
self.client_sysadmin.set_credentials(credentials)

def _connect_tenant(self, headers):
token = headers.get('x-vcloud-authorization')
Expand Down
Loading

0 comments on commit 397708e

Please sign in to comment.