Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hard stop when topo file is not present in WithTopoFile #418

Merged
merged 4 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clab/clab.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ func WithRuntime(name string, d bool, dur time.Duration, gracefulShutdown bool)
func WithTopoFile(file string) ClabOption {
return func(c *CLab) {
if file == "" {
return
log.Fatal("provide a path to the clab toplogy file")
}
if err := c.GetTopology(file); err != nil {
log.Fatalf("failed to read topology file: %v", err)
}

err := c.initMgmtNetwork()
if err != nil {
log.Fatalf("initMgmtNetwork: %s", err)
log.Fatalf("failed to init the management network: %s", err)
}

}
Expand Down
4 changes: 3 additions & 1 deletion cmd/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ var inspectCmd = &cobra.Command{
opts := []clab.ClabOption{
clab.WithDebug(debug),
clab.WithTimeout(timeout),
clab.WithTopoFile(topo),
clab.WithRuntime(rt, debug, timeout, graceful),
}
if topo != "" {
opts = append(opts, clab.WithTopoFile(topo))
}
c := clab.NewContainerLab(opts...)
if name == "" {
name = c.Config.Name
Expand Down
2 changes: 1 addition & 1 deletion docs/cmd/graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ If `--offline` flag was not provided and no containers were found matching the l

#### topology

With the global `--topo | -t` flag a user sets the path to the topology file that will be used to get the .
With the global `--topo | -t` flag a user sets the path to the topology file that will be used to get the nodes of a lab.

#### srv

Expand Down
1 change: 1 addition & 0 deletions docs/htmltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
DirectoryPath: ./site
IgnoreURLs:
- fonts.gstatic.com
- img.shields.io
IgnoreDirectoryMissingTrailingSlash: true
IgnoreAltMissing: true
IgnoreSSLVerify: true
Expand Down