glennmatthews / cot

Common OVF Tool
MIT License
90 stars 23 forks source link

cot edit-properties CLI rejects property value strings containing '=' #59

Closed ghost closed 7 years ago

ghost commented 7 years ago

I have automation that adds ssh private keys as properties on the ovf using cot 1.4.1. After updating to 1.7.4 this is not working. Playing around with the quotes didn't help either. Environment is bash on centos 6.

Eg.

cot edit-properties test.ovf -p 'autopubkey=ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuFzQ8Rd5k1USyoV50oOCsq5CiIxUrtPSeqiBpAAtrerfZrAbl1hOE8G3NSB97UolKzjAYVYSwaavXUomQhCAmjTa8wXszgl/p3Kf/tHyNYwxUUxUXQdAaiZSYd5f4UxdL71r2CSWHMhJq+t0giw6VF8+fuXxiDL+Bf5EPFwz7ZT0a1WLYOoK8eTve/YFL6jymOHzIvjW6+rzrhke/hCMVKQY/d7D7916x19N66AadJ0VQQmUmDXVUbUEGGdzgCwYF4Tq4oFKVgwQxl2dMkbnVisdSBbvN5bQP4oA10sTAVUj2mpN4HfsqZksDAHEL1NThKpOj8DSZlrA+PL4AJQTuw== root@MASTER-CentOS-6-Build-20170112140530100048' -o test.ova

 INFO: test.ovf' as OVF
    INFO: OVF version is 1.x
    INFO: OVF product class None --> platform GenericPlatform
usage: 
  cot edit-properties --help
  cot <opts> edit-properties PACKAGE [-p KEY1=VALUE1 [-p KEY2=VALUE2 ...]] [-l LABEL1 [-l LABEL2 ...]] [-d DESC1 [-d DESC2 ...]] [-c CONFIG_FILE] [-u [USER_CONFIGURABLE]] [-t TRANSPORT [TRANSPORT2 ...]] [-o OUTPUT]
  cot <opts> edit-properties PACKAGE [-u [USER_CONFIGURABLE]] [-o OUTPUT]
cot edit-properties: error: Invalid property 'autopubkey=ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuFzQ8Rd5k1USyoV50oOCsq5CiIxUrtPSeqiBpAAtrerfZrAbl1hOE8G3NSB97UolKzjAYVYSwaavXUomQhCAmjTa8wXszgl/p3Kf/tHyNYwxUUxUXQdAaiZSYd5f4UxdL71r2CSWHMhJq+t0giw6VF8+fuXxiDL+Bf5EPFwz7ZT0a1WLYOoK8eTve/YFL6jymOHzIvjW6+rzrhke/hCMVKQY/d7D7916x19N66AadJ0VQQmUmDXVUbUEGGdzgCwYF4Tq4oFKVgwQxl2dMkbnVisdSBbvN5bQP4oA10sTAVUj2mpN4HfsqZksDAHEL1NThKpOj8DSZlrA+PL4AJQTuw== root@MASTER-CentOS-6-Build-20170112140530100048' - properties must be in 'key[=value][+type]' form
glennmatthews commented 7 years ago

Thanks for the report. Looking into this. If it's a regression it is most likely due to #50.

glennmatthews commented 7 years ago

Looks like the issue is the == in the SSH key, causing the regexp match ^([^=+]+?)(=[^=+]*?)?(\+[^=+]*?)?$ to fail. My fault for enforcing that we have exactly one '=' in the entire string rather than being more flexible. Will work on a fix.

ghost commented 7 years ago

danke!