MCPcopy Create free account
hub / github.com/ceph/ceph / _validate_writable_file

Method _validate_writable_file

src/pybind/ceph_argparse.py:675–685  ·  view source on GitHub ↗
(self, fname)

Source from the content-addressed store, hash-verified

673 self.val = s
674
675 def _validate_writable_file(self, fname):
676 if os.path.exists(fname):
677 if os.path.isfile(fname):
678 if not os.access(fname, os.W_OK):
679 raise ArgumentValid('{0} is not writable'.format(fname))
680 else:
681 raise ArgumentValid('{0} is not file'.format(fname))
682 else:
683 dirname = os.path.dirname(fname)
684 if not os.access(dirname, os.W_OK):
685 raise ArgumentValid('cannot create file in {0}'.format(dirname))
686
687 def __str__(self):
688 return '<outfilename>'

Callers 1

validMethod · 0.95

Calls 4

ArgumentValidClass · 0.85
accessMethod · 0.80
existsMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected