Namespaces:
  =: io.murano.apps.test
  std: io.murano
  res: io.murano.resources
  sys: io.murano.system
  apps: io.murano.apps


Name: PolicyEnforcementTestApp

Extends: std:Application

Properties:
  name:
    Contract: $.string().notNull()

  instance:
    Contract: $.class(res:Instance).notNull()

  host:
    Contract: $.string()
    Usage: Out

  user:
    Contract: $.string()
    Usage: Out

Workflow:
  initialize:
    Body:
      - $.environment: $.find(std:Environment).require()

  deploy:
    Body:
      - If: !yaql "not bool($.getAttr(deployed))"
        Then:
          - $this.find(std:Environment).reporter.report($this, 'Creating VM ')
          - $securityGroupIngress:
              - ToPort: 22
                FromPort: 22
                IpProtocol: tcp
                External: True
          - $.environment.securityGroupManager.addGroupIngress($securityGroupIngress)
          - $.instance.deploy()
          - $resources: new(sys:Resources)
          - $this.find(std:Environment).reporter.report($this, 'Test VM is installed')
          - $.host: $.instance.ipAddresses[0]
          - $.user: 'root'
          - $.setAttr(deployed, True)

Namespaces:
  =: io.murano.apps.test
  std: io.murano
  res: io.murano.resources
  sys: io.murano.system


Name: PolicyEnforcementTestApp

Extends: std:Application

Properties:
  name:
    Contract: $.string().notNull()

  instance:
    Contract: $.class(res:Instance).notNull()

  host:
    Contract: $.string()
    Usage: Out

  user:
    Contract: $.string()
    Usage: Out

Methods:
  initialize:
    Body:
      - $._environment: $.find(std:Environment).require()

  deploy:
    Body:
      - If: not $.getAttr(deployed, false)
        Then:
          - $._environment.reporter.report($this, 'Creating VM')
          - $securityGroupIngress:
              - ToPort: 22
                FromPort: 22
                IpProtocol: tcp
                External: true
          - $._environment.securityGroupManager.addGroupIngress($securityGroupIngress)
          - $.instance.deploy()
          - $resources: new(sys:Resources)
          - $._environment.reporter.report($this, 'Test VM is installed')
          - $.host: $.instance.ipAddresses[0]
          - $.user: 'root'
          - $.setAttr(deployed, true)

Fix Policy Enforcement Test App
Fix Policy Enforcement Test App

Added small changes to test app

Change-Id: I79956625856a52a42289363aacb68f8799827830
