ioggstream

yaql_rg

Sep 8th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. parameters:
  2. items:
  3. type: comma_delimited_list
  4. default:
  5. - zone-1
  6. - zone-2
  7. - zone-3
  8.  
  9. resources:
  10.  
  11. # passing as param with casting says
  12. # ERROR: Property error: : resources.rg.properties.resource_def: : invalid literal for int() with base 10: '%index%'
  13. rg:
  14. type: OS::Heat::ResourceGroup
  15. properties:
  16. count: 3
  17. resource_def:
  18. type: OS::Heat::Value
  19. properties:
  20. value:
  21. yaql:
  22. expression:
  23. $.data.items.cycle().take(int($.data.idx))
  24. data:
  25. items:
  26. get_param: items
  27. idx:
  28. str_replace:
  29. template: '%index%'
  30. params: {}
  31.  
  32.  
  33. # passing directly
  34. rg:
  35. type: OS::Heat::ResourceGroup
  36. properties:
  37. count: 3
  38. resource_def:
  39. type: OS::Heat::Value
  40. properties:
  41. value:
  42. yaql:
  43. expression:
  44. $.data.items.cycle().take(%index%)
  45. data:
  46. items:
  47. get_param: items
  48.  
  49. # This prints
  50. # $.data.items.cycle().take(0)
  51. # $.data.items.cycle().take(1)
  52. # $.data.items.cycle().take(2)
  53. rg_str:
  54. type: OS::Heat::ResourceGroup
  55. properties:
  56. count: 3
  57. resource_def:
  58. type: OS::Heat::Value
  59. properties:
  60. value: >-
  61. $.data.items.cycle().take(%index%)
Advertisement
Add Comment
Please, Sign In to add comment