MCPcopy Index your code
hub / github.com/coder/coder / ExtractArchive

Method ExtractArchive

provisionersdk/tfpath/tfpath.go:77–90  ·  view source on GitHub ↗

ExtractArchive extracts the provided template source archive and modules archive into the working directory. `modulesArchive` is optional and can be nil or empty.

(ctx context.Context, logger slog.Logger, fs afero.Fs, templateSourceArchive, modulesArchive []byte)

Source from the content-addressed store, hash-verified

75// ExtractArchive extracts the provided template source archive and modules archive into the working directory.
76// `modulesArchive` is optional and can be nil or empty.
77func (l Layout) ExtractArchive(ctx context.Context, logger slog.Logger, fs afero.Fs, templateSourceArchive, modulesArchive []byte) error {
78 err := extractArchive(ctx, logger, fs, l.WorkDirectory(), templateSourceArchive)
79 if err != nil {
80 return xerrors.Errorf("extract template source archive: %w", err)
81 }
82
83 if len(modulesArchive) > 0 {
84 err = extractArchive(ctx, logger, fs, l.WorkDirectory(), modulesArchive)
85 if err != nil {
86 return xerrors.Errorf("extract modules archive: %w", err)
87 }
88 }
89 return nil
90}
91
92func isValidSessionDir(dirName string) bool {
93 match, err := filepath.Match(sessionDirPrefix+"*", dirName)

Callers 3

extractInitFunction · 0.80
InitMethod · 0.80
InitMethod · 0.80

Calls 3

WorkDirectoryMethod · 0.95
extractArchiveFunction · 0.85
ErrorfMethod · 0.45

Tested by 1

extractInitFunction · 0.64