Closed fzipi closed 4 years ago
@fzipi Thanks for the report, just some initial feedback for you. While we can look into why users.vimrc
isn't working, you may find users.user_files
more useful overall. You can use it to manage .vimrc
and any other files as well. This is the relevant section in pillar.example
:
I saw that, seems good. Just trying to be compatible with our old pillars (we were using an ancient users-formula version).
Do you think the user_files
is going to be the way to do it in the future? (makes sense if you want to be independent of the vim formula)
@fzipi I would say that user_files
is a better solution all round, compared to users.vimrc
specifically. In the meantime, I didn't see this in your original report:
Note, this is using the users-formula
pillar key as opposed to users
. Do you have that defined somewhere in your setup?
@myii Well, it is your setup. It is using the kitchen test files :)
I have it also in my setup ;)
@fzipi Well, we're not not currently testing the users.vimrc
state at the current time!
This is something that would be worth adding, though.
@myii That's what kind of added with my patch. To test that it is not working, sadly.
If you apply the patch, you'll see that it is indeed not working.
@fzipi I'm having a little look at this, I'll get back to you soon with some feedback. I see the contradiction that was introduced in #177, as you linked above.
@fzipi OK, progress made, got the state running but failing:
The changes made so far (ignore .travis.yml
, that's just to prevent all of the instances from running):
Removing jinja
as the template will probably finalise this.
Ok, this quick patch makes sense, and it is more or less what I've done:
{% if salt['pillar.get']('users-formula:use_vim_formula', False) %}
Ok, now the question is is it really working?
I mean, I've added some tests to see if the file ~/.vimrc
is created. Is that what this state is supposed to do?
Oh, yes. I see it now in my local test :). Thanks!
@fzipi You're welcome, thanks for the detailed bug report in the first place. It makes it much easier to conduct the bug hunt.
Moving forward, the obvious thing is to add these changes to the formula. There is a breaking change that needs to be avoided if possible, though: there may be users out there who are using .vimrc
Jinja templates. So may need to include the option of selecting the template as well, although I'm not keen on that either.
@myii For me the question is in this case if this was woking at all.... I don't see how after introducing the users.use_vim_formula
could have worked properly...
But I got your point.
@fzipi That most likely happened during the review of #177, specifically:
So this line also needed to be changed after the review but got overlooked.
Maybe relying on the extension? Like if file ends in .jinja
then apply jinja templating or nothing if not.
That won't work as-is, since the source
has been configured to look for vimrc
without an extension:
So the least harmful solution appears to be to modify users/files/vimrc/vimrc
to be an actual jinja
template.
Well, reading the file, we can think about just keeping things like they are now, and removing the {{{1
from the file, so they don't get parsed as jinja template tags....
Actually, I've already done this when managing files with user_files
. We can simply wrap most/all of the vimrc
template in raw
tags:
{% raw -%}
...
{%- endraw %}
That will solve this problem, without causing a breaking change. Just going to test that now.
Oh, that sounds like a lovely solution!
There we are, that's working:
I'll wrap this all into a PR so we can get this out there. Thanks again for all of the feedback, @fzipi!
Thanks to you!
If you want to add it to the PR, I've added some inspec test in the patch to verify that .vimrc is being created properly.
@fzipi Sure, I was just about to work on this! Do you mind putting this into a PR? We can merge this fix first and then the InSpec tests.
@fzipi Thanks, I'll continue the discussion there.
:tada: This issue has been resolved in version 0.48.4 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Your setup
Formula commit hash / release tag
Using 9ee7636477e20ad6597da2dd41375e858f644e4d.
Versions reports (master & minion)
I'm just using
kitchen test default-ubuntu-1804-2019-2-py3
Pillar / config used
Testing the pillar with the example test (
test/salt/pillar/default.sls
), and small patch. See below.Bug details
Describe the bug
After reading #166 , we still cannot make this state to work. I'm getting always
Steps to reproduce the bug
I'm using this patch in master to test:
Expected behaviour
A
/home/auser/.vimrc
file should exist.Attempts to fix the bug
Well, many. There seems to be a difference between documentation in docs/README.rst:
This depends on the vim-formula being available and pillar \
users:use_vim_formula: True`.vs. using
users-formula: use_vim_formula: true`.If I remove/change
{% if users.use_vim_formula %}
inusers/vimrc.sls
, of course this error is not there anymore. But then, it never gets executed also.Additional context