-->

SaltStack and GitFS - No Top file or external node

2019-07-17 05:13发布

问题:

Here is my /etc/salt/master config:

#GitFS
gitfs_provider: pygit2
gitfs_base: DEVELOPMENT
gitfs_env_whitelist:
  - base

fileserver_backend:
  - git
gitfs_remotes:
  - ssh://git@github.com/myrepo/salt-states.git:
    - pubkey: /root/.ssh/my.pub
    - privkey: /root/.ssh/my
    - mountpoint: salt:///srv/salt/salt-states

Here is my directory structure for the repo:

.
|-- README.md
|-- formulas
|   `-- test
|       |-- test.sls
`-- top.sls

Here is my very basic top.sls:

base:
  '*':
    - test

If i try to run highstate on my test node I get:

root@saltmaster:/etc/salt] salt -v '*' state.highstate
Executing job with jid 1234567890
-------------------------------------------

test-minion.domain:
----------
          ID: states
    Function: no.None
      Result: False
     Comment: No Top file or external nodes data matches found.
     Started:
    Duration:
     Changes:

Summary for test-minion.domain
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   0.000 ms

I'm not sure why this isn't working and would appreciate any help with this. I've tried just applying the test.sls to see if it was the top file that was the issue but I got this:

root@saltmaster:/etc/salt] salt -v '*' state.sls test
Executing job with jid 1234567890
-------------------------------------------

test-minion.domain:
    Data failed to compile:
----------
    No matching sls found for 'test' in env 'base'

回答1:

I had a similar problem, which was due to the cache being out of sync and not updating. If I tried to run:

salt-run fileserver.update

I got:

[WARNING ] Update lock file is present for gitfs remote 'git@github.com:mention-me/Salt.git', skipping. If this warning persists, it is possible that the update process was interrupted, but the lock could also have been manually set. Removing /var/cache/salt/master/gitfs/7d8d9790a933949777fd5a58284b8850/.git/update.lk or running 'salt-run cache.clear_git_lock gitfs type=update' will allow updates to continue for this remote.

Deleting the cache file specified, and running the above command fixed the problem.



回答2:

I talked to the folks on the saltstack IRC and someone helped me fix the problem. It seems that adding a mountpoint was screwing everything up. Credit goes to:

12:20] ==  realname : Thomas Phipps
[12:20] ==  channels : #salt
[12:20] ==  server   : orwell.freenode.net [NL]
[12:20] ==           : is using a secure connection
[12:20] ==  account  : whytewolf
[12:20] == End of WHOIS