3 from ceph_volume.api import lvm as lvm_api
8 def __init__(self, *a, **kw):
13 def __call__(self, *a, **kw):
14 self.calls.append({'args': a, 'kwargs': kw})
17 class Factory(object):
19 def __init__(self, **kw):
20 for k, v in kw.items():
35 def volumes(monkeypatch):
36 monkeypatch.setattr('ceph_volume.process.call', lambda x: ('', '', 0))
37 volumes = lvm_api.Volumes()
43 def volume_groups(monkeypatch):
44 monkeypatch.setattr('ceph_volume.process.call', lambda x: ('', '', 0))
45 vgs = lvm_api.VolumeGroups()
51 def is_root(monkeypatch):
53 Patch ``os.getuid()`` so that ceph-volume's decorators that ensure a user
54 is root (or is sudoing to superuser) can continue as-is
56 monkeypatch.setattr('os.getuid', lambda: 0)
62 Create a temporary file, optionally filling it with contents, returns an
63 absolute path to the file when called
65 def generate_file(name='file', contents=''):
66 path = os.path.join(str(tmpdir), name)
67 with open(path, 'w') as fp: