VM template with user_inputs instanstiated automatically (without 'human' intervention)


(Andres Pozo Muñoz) #1

Hi,

just wondering if there is any option I’m missing.
I’ve got some VM template with some user_input defined fields.

I’d like to instantiate the a VM of that template with the CLI client BUT ‘automatically’, this is, not providing the values with ‘human interaction’ but with the values in some key-value file.

I had a look at the onetemplate CLI command source code, and I think if the template has user_inputs, the launch of the helper to ‘interact with the human’ to get the values is launched mandatory.

Is there any way to provide the user_input field values in a file for the onetemplate CLI?
It can’t be done even defining a Oneflow service for the template ,right?
(we can do it with Oneflow API, but it would be better for us to be able to achieve it with the CLI (we want to do it from ansible))

Thanks in advance!

Regards,
Andrés


(Juan Jose Montiel Cano) #2

You can use the redirect of linux.

Something like this:
’ onetemplate instantiate “ID” < input_file.in ’

Regards!


#3

Hi @juanmont , Can you give-me example of the content of file “input_file.in”?

In my case, the template requires (in order): CPU, Memory and Password. In the input file I put:

1
1024
MyExamplePassWord@

But when execute this, happens this error:

$ onetemplate instantiate 57 < /tmp/input_file.in

Press enter for default (1). Please type the selection number: * (MEMORY)
Press enter for default (1024). Integer in the range [1024…131072]: * (PASSWORD) ROOT PASSWORD
Password: /usr/lib/one/ruby/cli/one_helper.rb:467:in noecho': Inappropriate ioctl for device (Errno::ENOTTY) from /usr/lib/one/ruby/cli/one_helper.rb:467:inget_password’
from /usr/lib/one/ruby/cli/one_helper/onetemplate_helper.rb:189:in block in get_user_inputs' from /usr/lib/one/ruby/cli/one_helper/onetemplate_helper.rb:140:ineach’
from /usr/lib/one/ruby/cli/one_helper/onetemplate_helper.rb:140:in get_user_inputs' from /bin/onetemplate:255:inblock (4 levels) in ’
from /usr/lib/one/ruby/cli/one_helper.rb:779:in call' from /usr/lib/one/ruby/cli/one_helper.rb:779:inperform_action’
from /bin/onetemplate:227:in block (3 levels) in <main>' from /bin/onetemplate:226:intimes’
from /bin/onetemplate:226:in block (2 levels) in <main>' from /usr/lib/one/ruby/cli/command_parser.rb:470:incall’
from /usr/lib/one/ruby/cli/command_parser.rb:470:in run' from /usr/lib/one/ruby/cli/command_parser.rb:84:ininitialize’
from /bin/onetemplate:34:in new' from /bin/onetemplate:34:in


#4

Anyone help-me?