1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 15:47:14 +01:00
Files
installer/docs
W. Trevor King edcd705e46 pkg/asset/filefetcher: Only load files on demand
Avoid:

  $ bin/openshift-install cluster
  FATAL Error executing openshift-install: open tests/smoke/vendor/github.com/prometheus/procfs/fixtures/26231/fd/0: no such file or directory

as the old implementation attempts to walk the whole directory and
hits:

  $ ls -l tests/smoke/vendor/github.com/prometheus/procfs/fixtures/26231/fd/
  total 0
  lrwxrwxrwx. 1 trking trking 24 Oct  5 01:26 0 -> ../../symlinktargets/abc
  lrwxrwxrwx. 1 trking trking 24 Oct  5 01:26 1 -> ../../symlinktargets/def
  lrwxrwxrwx. 1 trking trking 24 Oct  5 01:26 10 -> ../../symlinktargets/xyz
  lrwxrwxrwx. 1 trking trking 24 Oct  5 01:26 2 -> ../../symlinktargets/ghi
  lrwxrwxrwx. 1 trking trking 24 Oct  5 01:26 3 -> ../../symlinktargets/uvw

With this commit, we only load files from the disk when someone asks
for them.

I've adjusted the unit tests a bit because:

* ioutil.ReadFile returns errors like:

    read /: is a directory

  for directories.  There does not appear to be an analog to
  os.IsNotExist() for this condition, so instead of checking for it in
  the tests, I've just dropped the empty-string input cases.  If we
  break something and call FetchByName on an empty string, we want to
  error out, and that error message is appropriately descriptive
  already.

* Globs are not as precise as regular expressions, so our glob would
  match master-1x.ign and similar which the previous regexp excluded.
  But loading a few extra files doesn't seem like that big a deal, and
  folks adding files with names like that seems unlikely.
2018-10-19 11:27:07 -07:00
..