Repository navigation
Closed
Description
Description of Issue/Question
When using the --config-dir option, grains are not read from or written to {config-dir}/grains.
Setup
Create a config dir:
mkdir C:\Foo
Also create a grains file in the config-dir with the bar grain:
PS C:\Users\Administrator> cat C:\Foo\grains
bar: bar
Steps to Reproduce Issue
PS C:\Users\Administrator> C:\salt\salt-call.bat --local --config-dir C:\Foo grains.setval foo foo
local:
----------
foo:
foo
PS C:\Users\Administrator> cat C:\salt\conf\grains
foo: foo
PS C:\Users\Administrator> C:\salt\salt-call.bat --local --config-dir C:\Foo grains.get foo
local:
foo
PS C:\Users\Administrator> C:\salt\salt-call.bat --local --config-dir C:\Foo grains.get bar
local:
Note how the grain foo is written to the default config-dir, C:\salt\conf\grains, rather than the custom config-dir location, C:\Foo\grains.
Also note that the bar grain is not read.
Versions Report
This is Windows, obviously, but I saw the same behavior on Linux (Centos6 and 7).
PS C:\Users\Administrator> C:\salt\salt-call.bat --versions
Salt Version:
Salt: 2016.11.6
Dependency Versions:
cffi: 1.10.0
cherrypy: 7.1.0
dateutil: 2.5.3
docker-py: Not Installed
gitdb: 0.6.4
gitpython: 2.0.8
ioflo: 1.5.5
Jinja2: 2.9.4
libgit2: Not Installed
libnacl: 1.4.5
M2Crypto: Not Installed
Mako: 1.0.4
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
pycparser: 2.17
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)]
python-gnupg: 0.3.8
PyYAML: 3.11
PyZMQ: 16.0.1
RAET: Not Installed
smmap: 0.9.0
timelib: 0.2.4
Tornado: 4.4.1
ZMQ: 4.1.6
System Versions:
dist:
machine: AMD64
release: 2016Server
system: Windows
version: 2016Server 10.0.14393 Multiprocessor Free
Metadata
Metadata
Assignees
Labels
Corerelates to code central or existential to SaltP3Priority 3bugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundstale
Activity
gtmanfred commentedon Jan 8, 2018
I am unable to replicate this, it seems to be working fine for me with 2016.11.8 on windows 2016
Can you try upgrading to 2016.11.8 which is the latest version of 2016.11?
Thanks,
Daniel
lorengordon commentedon Jan 8, 2018
@gtmanfred Try doing it without creating the minion file first.
gtmanfred commentedon Jan 8, 2018
Ok, i am able to replicate it if the
minionfile does not exist in the config directory. My guess is that there is something in there on windows that validates the config-dir path, that just reverts back toc:\salt\confif the minion config file does not exist.@twangboy can you take a look at this?
Thanks,
Daniel
9 remaining items
gtmanfred commentedon Jan 8, 2018
What it seems like is happening, is if the conf_file does not exist in what the conf_dir is set to, we just keep the default, for conf_file and conf_dir, which is causing grains.setval to not write the grains to the correct file.
gtmanfred commentedon Jan 8, 2018
yup.
https://github.com/saltstack/salt/blob/2017.7/salt/config/__init__.py#L2044-L2053
gtmanfred commentedon Jan 8, 2018
Thanks @lorengordon this should be fixed by #45330
Daniel
lorengordon commentedon Jan 8, 2018
Makes sense to me, thanks @gtmanfred! Though I think you may want to keep the original
opts['conf_file'] = pathin place. Otherwise, theconf_filefrom the file will override the cli param. (Which would admittedly be a strange way to configure and call things, but still probably isn't the correct precedence ordering).gtmanfred commentedon Jul 9, 2018
This is going to require a change in how we load the config file, too many tests are failing for me to feel comfortable at changing this in a minor release.
I am going to leave this for now, if someone else runs across this, a PR would be welcome.
Thanks,
Daniel
stale commentedon Jan 8, 2020
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.