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!
You can use the redirect of linux.
Something like this:
’ onetemplate instantiate “ID” < input_file.in ’
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:
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
noecho': Inappropriate ioctl for device (Errno::ENOTTY) from /usr/lib/one/ruby/cli/one_helper.rb:467:inget_password’
block in get_user_inputs' from /usr/lib/one/ruby/cli/one_helper/onetemplate_helper.rb:140:ineach’
get_user_inputs' from /bin/onetemplate:255:inblock (4 levels) in ’
call' from /usr/lib/one/ruby/cli/one_helper.rb:779:inperform_action’
block (3 levels) in <main>' from /bin/onetemplate:226:intimes’
block (2 levels) in <main>' from /usr/lib/one/ruby/cli/command_parser.rb:470:incall’
run' from /usr/lib/one/ruby/cli/command_parser.rb:84:ininitialize’
new' from /bin/onetemplate:34:in’
I solved this problem using Python and paramiko. I writed a script that connect ssh in localhost and enter user inputs of “one template instantiate” as a human.