Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model Type in backup file #3249

Open
chrisch80 opened this issue Aug 22, 2024 · 3 comments
Open

Model Type in backup file #3249

chrisch80 opened this issue Aug 22, 2024 · 3 comments
Assignees

Comments

@chrisch80
Copy link

Hello,

Rancid writes in the first line of the backup file the model type:

example:
!RANCID-CONTENT-TYPE: cisco-xr

Whould this also be possible somehow with Oxidized?

br
Christoph

@ytti
Copy link
Owner

ytti commented Aug 22, 2024

I'm going to change your question.

a) Is it possible now, without touching code or model: No
b) Is it possible by touching code: Yes, I hope, obviously.

On avenue could be for example some metadata hash or array of strings, and we could have one string like 'model_name', if exists in array or hash key, output class could add it on top of every file. So all models would gain this feature, without touching models.

We could of course obviously emit that from models as well.

@robertcheramy robertcheramy self-assigned this Aug 31, 2024
@robertcheramy
Copy link
Collaborator

Implementing this feature independently of the models seems very elegant to me.
We currently have 28 models not having a comment defined, some of them just get a config file per ftp/http/scp.
Is it acceptable in these cases to prepend the medatada with the default comment (# )?

  • the user must remove it by hand when restoring a configuration.
  • I don't know if we backup binary data

We could provide a method and/or variable for the models do disable metadata, so that users ca disable the feature if they don't want it.

@ytti
Copy link
Owner

ytti commented Aug 31, 2024

We could provide a method and/or variable for the models do disable metadata, so that users ca disable the feature if they don't want it.

I'm thinking something like:

output:
  metadata:
    - model_name
    -  somethingelse

Not sure what configuration key would make most sense, and if it should be under output or main.

EDIT. Perhaps array of strings by location would be better?

output:
   metadata:
    top:
      - "!RANCID-CONTENT-TYPE: %model_name"
      -  "!DATE: %year-%month-€dayT%hour:%minute"

And is metadata most self-documenting, or is this like decorator or string.

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

No branches or pull requests

3 participants