Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
81fb06f5
Commit
81fb06f5
authored
May 09, 2024
by
Michael Yang
Browse files
more resilient Manifests
parent
a385382f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
server/manifest.go
server/manifest.go
+14
-3
server/manifest_test.go
server/manifest_test.go
+4
-0
No files found.
server/manifest.go
View file @
81fb06f5
...
@@ -125,13 +125,24 @@ func Manifests() (map[model.Name]*Manifest, error) {
...
@@ -125,13 +125,24 @@ func Manifests() (map[model.Name]*Manifest, error) {
ms
:=
make
(
map
[
model
.
Name
]
*
Manifest
)
ms
:=
make
(
map
[
model
.
Name
]
*
Manifest
)
for
_
,
match
:=
range
matches
{
for
_
,
match
:=
range
matches
{
rel
,
err
:=
filepath
.
Rel
(
manifests
,
match
)
fi
,
err
:=
os
.
Stat
(
match
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
n
:=
model
.
ParseNameFromFilepath
(
rel
)
if
!
fi
.
IsDir
()
{
if
n
.
IsValid
()
{
rel
,
err
:=
filepath
.
Rel
(
manifests
,
match
)
if
err
!=
nil
{
slog
.
Warn
(
"bad filepath"
,
"path"
,
match
,
"error"
,
err
)
continue
}
n
:=
model
.
ParseNameFromFilepath
(
rel
)
if
!
n
.
IsValid
()
{
slog
.
Warn
(
"bad manifest name"
,
"path"
,
rel
,
"error"
,
err
)
continue
}
m
,
err
:=
ParseNamedManifest
(
n
)
m
,
err
:=
ParseNamedManifest
(
n
)
if
err
!=
nil
{
if
err
!=
nil
{
slog
.
Warn
(
"bad manifest"
,
"name"
,
n
,
"error"
,
err
)
slog
.
Warn
(
"bad manifest"
,
"name"
,
n
,
"error"
,
err
)
...
...
server/manifest_test.go
View file @
81fb06f5
...
@@ -56,6 +56,10 @@ func TestManifests(t *testing.T) {
...
@@ -56,6 +56,10 @@ func TestManifests(t *testing.T) {
filepath
.
Join
(
"host"
,
"namespace"
,
"model"
,
"tag"
),
filepath
.
Join
(
"host"
,
"namespace"
,
"model"
,
"tag"
),
filepath
.
Join
(
"host"
,
"namespace"
,
"model"
,
".hidden"
),
filepath
.
Join
(
"host"
,
"namespace"
,
"model"
,
".hidden"
),
},
},
"subdir"
:
{
filepath
.
Join
(
"host"
,
"namespace"
,
"model"
,
"tag"
,
"one"
),
filepath
.
Join
(
"host"
,
"namespace"
,
"model"
,
"tag"
,
"another"
,
"one"
),
},
}
}
for
n
,
wants
:=
range
cases
{
for
n
,
wants
:=
range
cases
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment