diff --git a/lib/ramble/ramble/spack_runner.py b/lib/ramble/ramble/spack_runner.py index d6780860d..122729d16 100644 --- a/lib/ramble/ramble/spack_runner.py +++ b/lib/ramble/ramble/spack_runner.py @@ -602,16 +602,20 @@ def inventory_hash(self, require_exist=False): contents_to_hash = None if not self.dry_run: - if not lock_exists and (require_exist or len(self.env_contents) == 0): + if not lock_exists and require_exist and len(self.env_contents) > 0: logger.die( 'spack.lock file does not exist in environment ' f'{self.env_path}\n' 'Make sure your workspace is fully setup with\n' ' ramble workspace setup' ) + elif len(self.env_contents) == 0: + contents_to_hash = {} elif lock_exists: with open(spack_file, 'r') as f: contents_to_hash = sjson.load(f) + else: + logger.die('Issue with spack.lock file') if self.dry_run or not lock_exists: contents_to_hash = self._env_file_dict()