vyos.vyos icon indicating copy to clipboard operation
vyos.vyos copied to clipboard

Long config entries cause incorrect reading of device config

Open lucaelin opened this issue 3 years ago • 1 comments

SUMMARY

Setting config options with very long entries (>512), cause incorrect reading of the device config. I noticed this when setting the an ssh-rsa pubkey using the vyos_config module, as it would constantly claim that the key I am setting is different from the key found on the device, causing ansible to consider the task as "changed". When looking at the commands that come from the device and get compared to the desired config, I noticed that the 513th character in the line would get replaces by a space.

A dirty fix for this is to increase the terminal width to 1024 in https://github.com/ansible-collections/vyos.vyos/blob/main/plugins/terminal/vyos.py#L70

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos_config terminal

ANSIBLE VERSION
ansible [core 2.11.6] 
  python version = 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
  jinja version = 3.0.2
  libyaml = True
COLLECTION VERSION
https://github.com/lucaelin/vyos.vyos
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
- name: test ssh
  vyos_config:
    lines: 
      - set system login user ansible authentication public-keys ansible key 'veryveryveryveryverylongsshkey=='
EXPECTED RESULTS

The task should be ok when applied multiple times

ACTUAL RESULTS

The task is changed when applied multiple times


lucaelin avatar Dec 19 '21 17:12 lucaelin

I have this issue too, seems like a super simple fix?

lingfish avatar Aug 10 '22 01:08 lingfish