Skip to content

Commit 112f1e5

Browse files
committed
this all seems to work; except …
we're getting messages that (eg) ad5d369d1c80c22434890a49b84a2381b143a7da2db00ffcdf6404540a201eb6 somehow doesn't match ad5d369d1c80c22434890a49b84a2381b143a7da2db00ffcdf6404540a201eb6 hrm
1 parent ad659e5 commit 112f1e5

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

hubblestack/extmods/fileserver/gitfs.py

+7-20
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
AUTH_PARAMS = ('user', 'password', 'pubkey', 'privkey', 'passphrase',
6666
'insecure_auth')
6767

68-
# Import salt libs
69-
import salt.utils.gitfs
68+
from hubblestack.utils.signing import find_wrapf
69+
from hubblestack.extmods.utils.gitfs import GitFS
7070
from salt.exceptions import FileserverConfigError
7171

7272
log = logging.getLogger(__name__)
@@ -76,45 +76,42 @@
7676

7777

7878
def _gitfs(init_remotes=True):
79-
return salt.utils.gitfs.GitFS(
80-
__opts__,
81-
__opts__['gitfs_remotes'],
79+
return GitFS( __opts__, __opts__['gitfs_remotes'],
8280
per_remote_overrides=PER_REMOTE_OVERRIDES,
8381
per_remote_only=PER_REMOTE_ONLY,
8482
init_remotes=init_remotes)
8583

86-
8784
def __virtual__():
8885
'''
8986
Only load if the desired provider module is present and gitfs is enabled
9087
properly in the master config file.
9188
'''
9289
if __virtualname__ not in __opts__['fileserver_backend']:
90+
log.info("no fileserver_backend configs, skipping gitfs")
9391
return False
9492
try:
9593
_gitfs(init_remotes=False)
9694
# Initialization of the GitFS object did not fail, so we know we have
9795
# valid configuration syntax and that a valid provider was detected.
96+
log.error("have fileserver_backend configs and GitFS object loads: success loading %s", __virtualname__)
9897
return __virtualname__
9998
except FileserverConfigError:
10099
pass
100+
log.error("something went wrong loading GitFS object, claiming to not have gitfs")
101101
return False
102102

103-
104103
def clear_cache():
105104
'''
106105
Completely clear gitfs cache
107106
'''
108107
return _gitfs(init_remotes=False).clear_cache()
109108

110-
111109
def clear_lock(remote=None, lock_type='update'):
112110
'''
113111
Clear update.lk
114112
'''
115113
return _gitfs().clear_lock(remote=remote, lock_type=lock_type)
116114

117-
118115
def lock(remote=None):
119116
'''
120117
Place an update.lk
@@ -125,81 +122,71 @@ def lock(remote=None):
125122
'''
126123
return _gitfs().lock(remote=remote)
127124

128-
129125
def update(remotes=None):
130126
'''
131127
Execute a git fetch on all of the repos
132128
'''
133129
_gitfs().update(remotes)
134130

135-
136131
def update_intervals():
137132
'''
138133
Returns the update intervals for each configured remote
139134
'''
140135
return _gitfs().update_intervals()
141136

142-
143137
def envs(ignore_cache=False):
144138
'''
145139
Return a list of refs that can be used as environments
146140
'''
147141
return _gitfs().envs(ignore_cache=ignore_cache)
148142

149-
143+
@find_wrapf(not_found={'rel': '', 'path': ''}, real_path='path')
150144
def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
151145
'''
152146
Find the first file to match the path and ref, read the file out of git
153147
and send the path to the newly cached file
154148
'''
155149
return _gitfs().find_file(path, tgt_env=tgt_env, **kwargs)
156150

157-
158151
def init():
159152
'''
160153
Initialize remotes. This is only used by the master's pre-flight checks,
161154
and is not invoked by GitFS.
162155
'''
163156
_gitfs()
164157

165-
166158
def serve_file(load, fnd):
167159
'''
168160
Return a chunk from a file based on the data received
169161
'''
170162
return _gitfs().serve_file(load, fnd)
171163

172-
173164
def file_hash(load, fnd):
174165
'''
175166
Return a file hash, the hash type is set in the master config file
176167
'''
177168
return _gitfs().file_hash(load, fnd)
178169

179-
180170
def file_list(load):
181171
'''
182172
Return a list of all files on the file server in a specified
183173
environment (specified as a key within the load dict).
184174
'''
185175
return _gitfs().file_list(load)
186176

187-
188177
def file_list_emptydirs(load): # pylint: disable=W0613
189178
'''
190179
Return a list of all empty directories on the master
191180
'''
192181
# Cannot have empty dirs in git
193182
return []
194183

195-
196184
def dir_list(load):
197185
'''
198186
Return a list of all directories on the master
199187
'''
200188
return _gitfs().dir_list(load)
201189

202-
203190
def symlink_list(load):
204191
'''
205192
Return a dict of all symlinks based on a given path in the repo

0 commit comments

Comments
 (0)