diff --git a/meta/io.murano.applications/Classes/servers.yaml b/meta/io.murano.applications/Classes/servers.yaml index 08f88949..4e0b01f0 100644 --- a/meta/io.murano.applications/Classes/servers.yaml +++ b/meta/io.murano.applications/Classes/servers.yaml @@ -62,9 +62,9 @@ Methods: - server: Contract: $.class(res:Instance) Body: - - If: $this._env and name($server) and not $server.openstackId + - If: $this._env and not $server.openstackId Then: - - $this._env.reporter.report($this, 'Provisioning VM for ' + $server.name) + - $this._env.reporter.report($this, 'Provisioning VM for ' + name($server) or $server.name) - $server.beginDeploy() .destroy: @@ -94,11 +94,14 @@ Methods: - index: Contract: $.int().notNull() Body: - - $template[name]: $this.serverNamePattern.format($index) + - $template.name: $this.serverNamePattern.format($index) - $ownerGroup: $this.find(ServerGroup) - - If: $ownerGroup + - If: $ownerGroup and name($ownerGroup) Then: - - $template['?'][name]: format('Group {0} server {1}', name($ownerGroup), $index) + - $groupName: format(' ({0})', name($ownerGroup)) + Else: + - $groupName: '' + - $template['?'].name: format('Server {0}{1}', $index, $groupName) - Return: $template releaseReplica: diff --git a/meta/io.murano.applications/Classes/tests/TestServerProviders.yaml b/meta/io.murano.applications/Classes/tests/TestServerProviders.yaml index 1f9d0bfa..fe606543 100644 --- a/meta/io.murano.applications/Classes/tests/TestServerProviders.yaml +++ b/meta/io.murano.applications/Classes/tests/TestServerProviders.yaml @@ -107,8 +107,8 @@ Methods: name: testGroup - $namedSsg: new($model) - $namedSsg.deploy() - - $this.assertEqual('Group testGroup server 1', name($namedSsg.items[0])) - - $this.assertEqual('Group testGroup server 2', name($namedSsg.items[1])) + - $this.assertEqual('Server 1 (testGroup)', name($namedSsg.items[0])) + - $this.assertEqual('Server 2 (testGroup)', name($namedSsg.items[1])) testCreateMultipleServers: @@ -141,7 +141,7 @@ Methods: - $ssg.deploy() - $this.assertEqual('Creating 3 servers for TestGroup', $this.reports[0]) - $ssg.scale(-2) - - $this.assertEqual('Removing 2 servers from TestGroup', $this.reports[1]) + - $this.assertEqual('Removing 2 servers from TestGroup', $this.reports[4]) testMultipleServersReportingNoGroupName: Body: @@ -149,13 +149,13 @@ Methods: - $ssg.deploy() - $this.assertEqual('Creating 3 servers', $this.reports[0]) - $ssg.scale(-2) - - $this.assertEqual('Removing 2 servers', $this.reports[1]) + - $this.assertEqual('Removing 2 servers', $this.reports[4]) testNoReportingIfSingleServer: Body: - $ssg: new(apps:ServerGroup, $this.environment, TestGroup, provider=>$this.provider, numItems=>1) - $ssg.deploy() - - $this.assertEqual([], $this.reports) + - $this.assertEqual(1, len($this.reports)) assertServerCount: