Skip to content

set/get secret value do not work properly #89

Description

@oferb1

I have found the following issues when testing secrets (for Ceph storage pools)

  • setValue will clip the passed key
  • virsh 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());

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions