1 / 6

Script Invocation Conventions

Script Invocation Conventions. TOSCA Interop SC 2012-12-07. Introduction / Background. Current interop use case SugarCRM provides simple scripts as Implementation Artifacts for lifecycle operations of Node Types

cuyler
Download Presentation

Script Invocation Conventions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Script Invocation Conventions TOSCA Interop SC2012-12-07

  2. Introduction / Background • Current interop use case SugarCRM provides simple scripts as Implementation Artifacts for lifecycle operations of Node Types • Conventions have to be defined to allow for interoperable invocation of those scripts in different TOSCA implementations • References to actual scripts in CSAR • Parameter passing from model to script • … • Note: bindings to several script languages have to be defined. For now, only bash scripts are used, so we concentrate on a bash binding.

  3. Script Artifact Definitions • Non-normative Artifact Type “ScriptArtifact” defined in interop use case  Has to be documented; candidate for normative definition in TOSCA vNext • ScriptLanguage: specifies the used script language  impact on invocation convention, parameters passing, etc. • PrimaryScript: specifies the “entry script” to be invoked in cases where multiple files are referenced by an ArtifactTemplate (e.g. is main script brings with it additional helper or library files) • ArtifactReferences element uses Ant fileset like notation • reference attribute can specify a file or directory • If reference points to a directory, files in the directory to be referenced by the ArtifactTemplate are specified thru include and exclude patterns • Relative reference URIs in ArtifactTemplate elements are interpreted relative to the CSAR root directory <ArtifactTemplate id="at-c1ab1a58-91f1-49ec-a3e0-57f46e3d72e1“ type="ns1:ScriptArtifact"> <Properties> <ns1:ScriptArtifactProperties xmlns:ns1="http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes" xmlns="http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes"> <ScriptLanguage>sh</ScriptLanguage> <PrimaryScript>scripts/MySQL/configure.sh</PrimaryScript> </ns1:ScriptArtifactProperties> </Properties> <ArtifactReferences> <ArtifactReference reference="scripts/MySQL"> <Include pattern="configure.sh"/> </ArtifactReference> </ArtifactReferences> </ArtifactTemplate>

  4. Invocation Conventions for bash scripts • Parameters are passed to script as environment variables • Script can access parameters by name using $<parameter name> notation • Scripts in current interop example are supposed to be executed on the target environment (i.e. VMs created during service instantiation) • Invocation mechanism • Make script (incl. potential helper files) available on target environment • Create a new bash • Set all parameters to be passed to script as environment parameters • Invoke script • Process return code; read out potential return parameters the script may have written to environment variables

  5. Parameter conventions for scripts of Node Type Operations • Pass all properties of the Node instance (instantiated Node Template) to script as environment variables • Pass special parameter like “PublicIP” as environment variables • Denotes the public IP address of the VM on which the Node is deployed (i.e. avoids having to define a PublicIP property for each Node Type) • Example: configure.sh of SugarCRMApplication • NodeTypeSugarCRMApplication defines parameters AdminUser, AdminPassword, etc. • Script can access parameters like$AdminUser$AdminPassword…

  6. Parameter passing for scripts of Relationship Type Operations • Pass all properties of the Relationship instance (instantiated Relationship Template) as environment variables • Accessible by script as $<relationship property name> • Pass all properties (and special properties like PublicIP) of the source Node instance of the relationship as environment variables with prefix “Source_” • Accessible by script as$Source_<source node property name> • Pass all properties (and special properties like PublicIP) of the target Node instance of the relationship as environment variables with prefix “Target_” • Accessible by script as$Target_<target node property name> • Example: connectToDatabase.sh of MySQLDatabaseConnection…sed -i -e 's/YOURDBHOST/'${Target_PublicIP}:${Target_mySqlPort}'/' $ResponseFilesed -i -e 's/YOURDBNAME/'${Target_DBName}'/' $ResponseFilesed -i -e 's/YOURDBUSER/'${Target_DBUser}'/' $ResponseFile…

More Related