Open
Description
I have found the following issues when testing secrets (for Ceph storage pools)
setValue
will clip the passed keyvirsh
retrieves the data base64 transposed
const Promise = require('bluebird'),
exec = Promise.promisify(require('child_process').exec),
virt = require('libvirt'),
uuid = require('uuid');
let secretUUID = uuid.v4(),
secretXml = `<secret ephemeral="no" private="no"><uuid>${secretUUID}</uuid><usage type="ceph">` +
'<name>client.test secret</name></usage></secret>',
key = 'do not tell anyone',
secret;
let hv = virt.createHypervisor('qemu:///system');
hv.connectAsync()
.then(() => hv.defineSecretAsync(secretXml))
.then(_secret => {
secret = _secret;
secret.setValueAsync(key);
})
.then(() => secret.getValueAsync())
.then(value => console.log(`setValue('${key}'), while getValue() returns '${value}'`))
.then(() => exec(`virsh secret-get-value ${secretUUID}`))
.then(stdout => console.log(`virsh reads the secret value as '${stdout.trim()}', which is base64 transposed of the cropped key`))
.then(() => secret.undefineAsync())
.then(() => hv.disconnectAsync());
Metadata
Assignees
Labels
No labels
Activity