Openstack CLI giving invalid command

I deployed the Openstack with cloud init qcow2. Upon login over ssh I’m getting the following if I try to run any of the VyOS CLI commands.

 $ show version

  Invalid command: [show]

I know using cloud init it is best to put all config in the cloud-config piece, but we do quick sniff test and modifications live so CLI access would be nice. The interesting part is that if I drop to a root shell it works as I’d expect; but this isn’t something I want to do.

$ sudo show version
sudo: show: command not found
$ sudo -s
vbash-4.1# show version
Version:          VyOS 1.2.7
Release Train:    crux...

Is this expected and just an artifact of running with cloud-init? Or is there something I’m missing?

Never seen anything like this. It looks like a broken environment or a wrong shell.
Could you describe how did you get this, step by step?

I downloaded the latest LTS Openstack with cloud-init from the support portal. Created a VM on my Nutanix AHV host with the following cloud init config(secrets redacted).

#cloud-config
users:
  - name: vyos
    passwd: "REDACTED"
    ssh_authorized_keys:
      - "REDACTED"
write_files:
- content: |
    # My DFSDIR file

    DFSDIR="/ngd/development"
  path: /home/vyos/dfsdir.sh
vyos_config_commands:
  - set system host-name 'vyos-test'
  - set system ntp server 1.pool.ntp.org
  - set system ntp server 2.pool.ntp.org

Once it came up and I got the IP I sshd in and that was the results. This is a basic cloud-config to prove that it works. All the config is there as I’d expect.

Hi, @stormbard!
It seems that your cloud-config overwrites VyOS-specific parameters of a user profile. You do not need to mix different config modules. If you are using vyos_config_commands, better to configure users there. Try this, please:

#cloud-config
write_files:
- content: |
    # My DFSDIR file

    DFSDIR="/ngd/development"
  path: /home/vyos/dfsdir.sh
vyos_config_commands:
  - set system host-name 'vyos-test'
  - set system login user vyos authentication plaintext-password 'REDACTED'
  - set system login user vyos authentication public-keys key01 key 'REDACTED'
  - set system login user vyos authentication public-keys key01 type 'key_type_here'
  - set system ntp server 1.pool.ntp.org
  - set system ntp server 2.pool.ntp.org

Hey @zsdc,
Ah, didn’t realize that. I tried the cloud config you suggested and hit the same issue. I took it a step further and removed the write_files from the cloud config and used the below. This config worked without issue.

#cloud-config
vyos_config_commands:
  - set system host-name 'vyos-test'
  - set system login user vyos authentication plaintext-password 'REDACTED'
  - set system login user vyos authentication public-keys key01 key 'REDACTED'
  - set system login user vyos authentication public-keys key01 type 'key_type_here'
  - set system ntp server 1.pool.ntp.org
  - set system ntp server 2.pool.ntp.org

It seems that adding any other module other than the vyos_config_commands causes this issue. is there anyway via that to module to write a custom file to the VM?

Actually, only write_files and vyos_config_commands are supported. Maybe placing something into the /home/vyos/ directory breaks the user properties… Try to put your custom files into the /opt/vyatta/config/ instead.

Writing to /opt/vyatta/config results in the file not being there. The cloud-init log says it was successful but I do not see anything there. But I can successfully write to /opt and /etc without issue. I think this gets me where I want though; which is to drop some systemd unit files and some extra scripts. Thanks for the help.