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

Add feature to show resulting config #443

Closed
afbjorklund opened this issue Dec 2, 2021 · 5 comments
Closed

Add feature to show resulting config #443

afbjorklund opened this issue Dec 2, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@afbjorklund
Copy link
Member

Currently the default template is included in limactl info, but in a different format (JSON instead of YAML)

It would be more useful if it was shown in the same format, without the comments and with values replaced...

limactl config [FILE.yaml...]

Also add a small helper function, to compare a template against the default.

This is more handy than dumping two yaml files and running diff on them.

limactl config --diff FILE.yaml...
@jandubois
Copy link
Member

Currently the default template is included in limactl info, but in a different format (JSON instead of YAML)

And I have wondered what the use case was for that as well: #280 (comment)

It would be more useful if it was shown in the same format, without the comments and with values replaced...

Useful for what? Just removing the comments?

$ yq eval '... comments=""' /usr/local/share/doc/lima/examples/default.yaml
arch: "default"
images:
  - location: "~/Downloads/impish-server-cloudimg-amd64.img"
    arch: "x86_64"
  - location: "~/Downloads/impish-server-cloudimg-arm64.img"
    arch: "aarch64"
  - location: "https://cloud-images.ubuntu.com/impish/current/impish-server-cloudimg-amd64.img"
    arch: "x86_64"
  - location: "https://cloud-images.ubuntu.com/impish/current/impish-server-cloudimg-arm64.img"
    arch: "aarch64"
cpus: 4
memory: "4GiB"
disk: "100GiB"
mounts:
  - location: "~"
    writable: false
  - location: "/tmp/lima"
    writable: true
ssh:
  localPort: 0
  loadDotSSHPubKeys: true
  forwardAgent: false
containerd:
  system: false
  user: true
firmware:
  legacyBIOS: false
video:
  display: "none"
networks:
propagateProxyEnv: true
useHostResolver: true

I would find the config command more useful (after #436 is done) if it displayed the merged config, and not just the original YAML without comments.

limactl config [FILE.yaml...]

Also add a small helper function, to compare a template against the default.

This is more handy than dumping two yaml files and running diff on them.

Maybe, but not really by a lot.

limactl config --diff FILE.yaml...

This I find somewhat useful, except I would want to be able to compare any 2 config files, and not just one file against the default.

However, you can mostly already do this with yq as well; it just doesn't fill in the default values, so they show up in the diff if just one of the files specifies them.

$ diff -u <(yq eval -P '... comments=""' examples/docker.yaml) <(yq eval -P '... comments=""' examples/podman.yaml)

But even then I see very little benefit over just running diff -u between the 2 files, at least for the config files I used for testing.

My Main point

I'm concerned about "littering" limactl with too many subcommands that are most likely useless for the vast majority of users. They will present a cognitive barrier for new users to getting started with lima. If nothing else, it is more and more stuff to read through, just to find out it is not relevant to you.

Not sure what the right level of compromise is, but I feel like both config and du are not really important subcommands (and yes, I've mostly felt like that about info too, but I can see it being useful as we add more information to it).

To me the barrier to inclusion in limactl should be: "What end-user problem is this solving, and how?". There should be a compelling answer to this before we add anything.

Maybe the commands that don't clear the barrier can be moved to a separate utility/helper tool?

@AkihiroSuda
Copy link
Member

AkihiroSuda commented Dec 3, 2021

Maybe we can have config and du as subcommands of limactl debug.

info can be perhaps moved/aliased there too.

@afbjorklund
Copy link
Member Author

I was looking at the similar config command for compose, that is why.

But it can be done in the shell instead, using yq and friends, so closing.

@afbjorklund
Copy link
Member Author

It would be more useful if it was shown in the same format, without the comments and with values replaced...

Useful for what?

I meant that it could be fed back into the tool, as config for another instance. Or diffed. Harder to do, with json vs yaml ?

@afbjorklund
Copy link
Member Author

I'm concerned about "littering" limactl with too many subcommands that are most likely useless for the vast majority of users.

Good thing I didn't include the "color diff" then, which was mostly left out due to adding dependencies (and thus some extra bloat)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants