
Now all OpenStack resource classes inherit CloudResource that provides getRegion method and regionName property. This allows to assign resources to different regions. getRegion() returns CloudRegion instance that resource or it parent belong to. CloudRegion has the similar interface to Environment class and is the correct way to get HeatStack instance associated with the regoin, default network configuration, security group manager and agent listener instances. Environment acts as the default region so backward compatibility is not broken. However new applications should not use environment to set security group rules but rather a region(s) of their instance(s) in order to work correctly when their instances were configured to use region other then the default. Change-Id: I4dbf40c65042e9a354f3bfadfcd63a63e6e3e418
57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
Namespaces:
|
|
=: io.murano.resources
|
|
sys: io.murano.system
|
|
std: io.murano
|
|
|
|
Name: ConfLangInstance
|
|
|
|
Extends:
|
|
- LinuxMuranoInstance
|
|
|
|
Methods:
|
|
prepareUserData:
|
|
Body:
|
|
- $userData: $.generateUserData()
|
|
- Return:
|
|
data: $._generateInstanceConfigResources($userData)
|
|
format: RAW
|
|
|
|
_generateInstanceConfigResources:
|
|
Arguments:
|
|
- userData:
|
|
Contract: $.string().notNull()
|
|
Body:
|
|
- $region: $.getRegion()
|
|
- $cloudInitConf: $.generateCloudConfig()
|
|
- $bootConfigResourceName: format('boot_config_{0}', $.name)
|
|
- $bootScriptResourceName: format('boot_script_{0}', $.name)
|
|
- $userDataResourceName: format('user_data-{0}', $.name)
|
|
- $template:
|
|
resources:
|
|
$bootConfigResourceName:
|
|
type: 'OS::Heat::CloudConfig'
|
|
properties:
|
|
cloud_config: $cloudInitConf
|
|
$bootScriptResourceName:
|
|
type: 'OS::Heat::SoftwareConfig'
|
|
properties:
|
|
group: ungrouped
|
|
config: $userData
|
|
$userDataResourceName:
|
|
type: 'OS::Heat::MultipartMime'
|
|
properties:
|
|
parts:
|
|
- config: {get_resource: $bootConfigResourceName}
|
|
- config: {get_resource: $bootScriptResourceName}
|
|
|
|
- $region.stack.updateTemplate($template)
|
|
- Return: {get_resource: $userDataResourceName}
|
|
|
|
|
|
generateCloudConfig:
|
|
Body:
|
|
- $cloudConfigData: cast($, LinuxMuranoInstance).generateCloudConfig()
|
|
- $confLang: sys:Resources.yaml('conflang.conf')
|
|
- $cloudInitConf: $cloudConfigData.mergeWith($confLang)
|
|
- Return: $cloudInitConf
|