openvcloud / 0-templates

Apache License 2.0
1 stars 5 forks source link

Can't update values for an account (or any service ) #50

Closed john-kheir closed 6 years ago

john-kheir commented 6 years ago

Scenario

1- Run a blueprint to create an account, should succeed

services:
    - github.com/openvcloud/0-templates/sshkey/0.0.1__key2:
        path: '/root/.ssh/id_rsa'
        passphrase: 'testing'
    - github.com/openvcloud/0-templates/openvcloud/0.0.1__be-g8-3:
        address: 'be-g8-3.demo.greenitglobe.com'
        login: 'kheirj@itsyouonline'
        token: '***'
        location: be-g8-3
    - github.com/openvcloud/0-templates/vdcuser/0.0.1__kheirj:
        openvcloud: be-g8-3
        provider: itsyouonline
        email: kheirj@greenitglobe.com
    - github.com/openvcloud/0-templates/account/0.0.1__acctest1:
        openvcloud: be-g8-3
        maxMemoryCapacity: 10
        users:
             - accesstype: CXDRAU
               name: kheirj
actions:
    - template: github.com/openvcloud/0-templates/account/0.0.1
      actions: ['install']

    - template: github.com/openvcloud/0-templates/vdcuser/0.0.1
      actions: ['install']

2- Run the same blueprint again with changing maxMemoryCapacity to 9 and adding maxNumPublicIP param.


services:
    - github.com/openvcloud/0-templates/sshkey/0.0.1__key2:
        path: '/root/.ssh/id_rsa'
        passphrase: 'testing'
    - github.com/openvcloud/0-templates/openvcloud/0.0.1__be-g8-3:
        address: 'be-g8-3.demo.greenitglobe.com'
        login: 'kheirj@itsyouonline'
        token: '***'
        location: be-g8-3
    - github.com/openvcloud/0-templates/vdcuser/0.0.1__kheirj:
        openvcloud: be-g8-3
        provider: itsyouonline
        email: kheirj@greenitglobe.com
    - github.com/openvcloud/0-templates/account/0.0.1__acctest1:
        openvcloud: be-g8-3
        maxMemoryCapacity: 9
        maxNumPublicIP: 2
        users:
             - accesstype: CXDRAU
               name: kheirj
actions:
    - template: github.com/openvcloud/0-templates/account/0.0.1
      actions: ['install']

    - template: github.com/openvcloud/0-templates/vdcuser/0.0.1
      actions: ['install']

Actual Result

data.yaml file has been updated but this change hasn't been reflected on OVC

root@0-robot2:/opt/code/github/john-kheir/0-robot6/zrobot_data/github.com/openvcloud/0-templates/account/acctest1/f279350c-0ce4-464a-a37b-6d7c23d1434b# cat data.yaml 
accountID: 1416
consumptionData: !!binary ""
consumptionFrom: 0
consumptionTo: 0
create: true
description: ''
maxCPUCapacity: -1
maxDiskCapacity: -1
maxMemoryCapacity: 9
maxNumPublicIP: 2
openvcloud: be-g8-3
users:
-   accesstype: CXDRAU
    name: kheirj

scctest1

chrisvdg commented 6 years ago

This is not the way to update the values.

The update or update_data action with args should be called when you want to make sure those values will be set on ovc.

When you run install, it will check of the service is already running, if so, it will use the existing service and does not do any request to update the values on ovc. When the service is not running, it will create it using the provided parameters to set everything up properly.

zaibon commented 6 years ago

Please check this documentation to understand how the update of value works from a blueprint: https://github.com/Jumpscale/0-robot/tree/master/docs/services#update-data-from-blueprint

chrisvdg commented 6 years ago

Updating the data for a service should be done using the update action.