Generate template SQL

We have created a script to generate the SQL needed to add templates to the OnApp Control Panel.

1. Download the script:

# wget 

2. Run the script:

For example, to get the SQL for the template in our example, for OnApp CP version 2.1.1:

# sh ~/ -v 2.1.1 -m SQL -d /data/templates/Linux/ -t centos-5.5-x64-1.0.tar.gz 

And the result will be:

INSERT INTO `templates` (label, created_at, version, file_name, operating_system, operating_system_distro, allowed_swap, state, checksum, allow_resize_without_reboot, min_disk_size, template_size, operating_system_arch, operating_system_edition, operating_system_tail, allowed_hot_migrate, virtualization) VALUES ('CentOS 5.5 x64', NOW(), '1.0', 'centos-5.5-x64-1.0.tar.gz', 'linux', 'rhel', 1, 'active', 'fe520abaff0b0fbe85b3a359c50e7027', 1, 5, '312468', 'x64', NULL, NULL, 1, 'xen,kvm');