2016-08-30 3 views
0

私は、塩のドキュメンテーションが私の解決に役立つことができないというジレンマを抱えています。私はgitのリポジトリからファイルを取得しようとしているとslsのファイルを管理するよりです。 私は次のようにマスターを設定している:gitfs_remotesさんの塩で、slsファイルで適切に参照する方法は?ファイルは提供されていますが、参照はできません

gitfs_provider: pygit2 
fileserver_backend: 
- git 
- roots 
file_roots: 
    base: 
    - /srv/salt/ 
    dev: 
    - /srv/salt/dev/ 
    int: 
    - /srv/salt/int/ 
    qa: 
    - /srv/salt/qa/ 
    stg: 
    - /srv/salt/stg/ 
    prod: 
    - /srv/salt/prod/ 

私は、リモート指定されたものがあります:私は、次の、そして唯一のエントリしている私のSLSで

gitfs_remotes: 
- https://server.com/path/to/repo.git: 
    - user: salt 
    - password: salt 
    - root: path/to/file/in/git 
    - mountpoint: salt://dev 

を:

jbiam.yaml: 
file.managed: 
- name: /srv/salt/dev/files/application.yml 
- source: salt://application.yml 
- user: root 
- group: root 
- mode: 655 
- template: jinja 
- defaults: 
    bla: "bla" 

私は開発環境のハイステートを実行します:

salt '*' state.highstate env=dev 

現在、ソースに入れてもパスワイズでファイルを見つけることはありません。 私は現時点で迷っています.... ファイルをsalt fsのルートに追加すると、期待される。しかし、gitfsでそれは動作していません。 git remote configからマウントポイントを削除し、環境なしでハイステートを実行した場合、環境を導入すると直ぐにファイルを見つけることができません。

salt-run fileserver.file_list iを実行すると記載されているファイルを参照してください。

salt-run fileserver.file_list 
[DEBUG ] Configuration file path: /etc/salt/master 
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged. 
[DEBUG ] LazyLoaded fileserver.file_list 
[DEBUG ] Reading configuration from /etc/salt/master 
[DEBUG ] Guessing ID. The id can be explicitly set in /etc/salt/minion 
[DEBUG ] Found minion id from generate_minion_id(): bla 
[DEBUG ] Reading configuration from /etc/salt/master 
[DEBUG ] MasterEvent PUB socket URI: /var/run/salt/master   /master_event_pub.ipc 
[DEBUG ] MasterEvent PULL socket URI: /var/run/salt/master /master_event_pull.ipc 
[DEBUG ] Initializing new IPCClient for path: /var/run/salt/master/master_event_pull.ipc 
    [DEBUG ] Sending event - data = {'fun': 'runner.fileserver.file_list', 'jid': '20160830220634591807', 'user': 'root', '_stamp': '2016-08-31T02:06:35.031018'} 
[DEBUG ] pygit2 gitfs_provider enabled 
[DEBUG ] LazyLoaded git.envs 
[DEBUG ] LazyLoaded roots.envs 
[DEBUG ] LazyLoaded nested.output 
- .git/HEAD 
- .git/config 
- .git/description 
- .git/hooks/applypatch-msg.sample 
- .git/hooks/commit-msg.sample 
- .git/hooks/post-update.sample 
- .git/hooks/pre-applypatch.sample 
- .git/hooks/pre-commit.sample 
- .git/hooks/pre-push.sample 
- .git/hooks/pre-rebase.sample 
- .git/hooks/prepare-commit-msg.sample 
- .git/hooks/update.sample 
- .git/index 
- .git/info/exclude 
- .git/logs/HEAD 
- .git/logs/refs/heads/master 
- .git/logs/refs/remotes/origin/HEAD 
- .git/objects/pack/pack-280ac298a92c1fde082a7d7d84da86d855720a3a.idx 
- .git/objects/pack/pack-280ac298a92c1fde082a7d7d84da86d855720a3a.pack 
- .git/packed-refs 
- .git/refs/heads/master 
- .git/refs/remotes/origin/HEAD 
- .gitignore 
- dev/application.yml 
- dev/bootstrap.yml 

をしかし、私はちょうどカントの参照、それを私はそれを実行すると:

site.com: 
    ---------- 
     ID: /srv/salt/dev/files/application.yml 
Function: file.managed 
    Result: False 
Comment: Source file salt://application.yml not found 
Started: 22:31:29.496613 
Duration: 33.199 ms 
Changes: 

Summary for site.com 
    ------------ 
Succeeded: 0 
Failed: 1 
    ------------ 
Total states run:  1 

答えて

0

を持って事前にありがとうございましたソースURIにdevで試してみましたか?

jbiam.yaml: 
    file.managed: 
    - name: /srv/salt/dev/files/application.yml 
    - source: salt://dev/application.yml 
0

どのgitブランチを使用しているかは一度も述べていません。私の推測では、あなたは単に "マスター"ブランチでそれを持っているということです。

gitfsはブランチ/タグをファイルサーバー環境にマップすることに注意してください。したがって、salt-run fileserver.file_listを実行したときには、ファイルサーバのbasemasterブランチにマップされています)のファイルをリストしていました。後で(注意:新しい塩のリリースではなくenvsaltenvを必要とする)env=devを使用して実行すると

、あなたはdevブランチ/タグからファイルを引っ張るために塩を語っています。

ここではdevというブランチにファイルがあり、saltenv=devを使用してそのファイルを参照する必要がある場合は、masterブランチにファイルがあると思います。

関連する問題