mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -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
|
#!/usr/bin/ruby
|
||||||
|
|
||||||
|
require 'json'
|
||||||
require 'rbvmomi'
|
require 'rbvmomi'
|
||||||
require 'redis'
|
require 'redis'
|
||||||
require 'time'
|
require 'time'
|
||||||
|
|
@ -164,9 +165,12 @@ def clone_vm template, pool, folder, datastore
|
||||||
|
|
||||||
# Annotate with creation time, origin template, etc.
|
# Annotate with creation time, origin template, etc.
|
||||||
configSpec = RbVmomi::VIM.VirtualMachineConfigSpec(
|
configSpec = RbVmomi::VIM.VirtualMachineConfigSpec(
|
||||||
:annotation =>
|
:annotation => JSON.pretty_generate({
|
||||||
'Base template: ' + vm['template'] + "\n" +
|
name: vm['hostname'],
|
||||||
'Creation time: ' + Time.now.strftime("%Y-%m-%d %H:%M")
|
created_by: $config[:vsphere]['username'],
|
||||||
|
base_template: vm['template'],
|
||||||
|
creation_timestamp: Time.now.utc
|
||||||
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
# Put the VM in the specified folder and resource pool
|
# Put the VM in the specified folder and resource pool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue