mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Merge pull request #7 from sschneid/json_annotation
Store annotation in JSON format
This commit is contained in:
commit
34b74b8782
1 changed files with 7 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
require 'json'
|
||||
require 'rbvmomi'
|
||||
require 'redis'
|
||||
require 'time'
|
||||
|
|
@ -164,9 +165,12 @@ def clone_vm template, pool, folder, datastore
|
|||
|
||||
# Annotate with creation time, origin template, etc.
|
||||
configSpec = RbVmomi::VIM.VirtualMachineConfigSpec(
|
||||
:annotation =>
|
||||
'Base template: ' + vm['template'] + "\n" +
|
||||
'Creation time: ' + Time.now.strftime("%Y-%m-%d %H:%M")
|
||||
:annotation => JSON.pretty_generate({
|
||||
name: vm['hostname'],
|
||||
created_by: $config[:vsphere]['username'],
|
||||
base_template: vm['template'],
|
||||
creation_timestamp: Time.now.utc
|
||||
})
|
||||
)
|
||||
|
||||
# Put the VM in the specified folder and resource pool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue