Skip to content

Spack 1.x key error when trying to create a new site #126

Description

@heatherkellyucl

If you try and use spacksites with Spack 1.x it currently gets to:

(This is Spack 1.1, some previous testing in dev-b)

# SPACKSITES: Now calling: #######
 source /lustre/scratch/ccspapp/spack/1.1/hpc-spack/spacksites/process-env-scripts/spack-deps.sh

source  /lustre/apps/spack/1.1/deploy/2026-hk/spack/share/spack/setup-env.sh
spack config --scope=site get config
# SPACKSITES: ####################
Traceback (most recent call last):
  File "/lustre/scratch/ccspapp/spack/1.1/hpc-spack/spacksites/spacksites", line 195, in <module>
    run_with_cli_args()
  File "/lustre/scratch/ccspapp/spack/1.1/hpc-spack/spacksites/spacksites", line 190, in run_with_cli_args
    args.func(args)
  File "/lustre/scratch/ccspapp/spack/1.1/hpc-spack/spacksites/spacksites", line 35, in create
    Site(os.path.join(config.spack_sites_root, args.site_name), config.initial_site_config_yaml, 
  File "/lustre/scratch/ccspapp/spack/1.1/hpc-spack/spacksites/src/spacksite.py", line 35, in __init__
    build_stage_raw = config_yaml['config']['build_stage']
KeyError: 'build_stage'

I've had a chance to look at why we couldn't easily switch to Spack 1.x and it is because we do config_yaml_raw, err = self.run_commands(['spack config --scope=site get config']) to get then parse and alter some of the keys in the site config - but in Spack 1.2 if you run spack config --scope=site get config you just get config: {} so we can't then set values for the build_stage key and write it out again - because there aren't any keys! If we need all the keys, looks like we need --scope=defaults:base perhaps.

No config

[cceahke@login21 spack]$ spack config --scope=site get config
config: {}

A short config

[cceahke@login21 spack]$ spack config --scope=_builtin get config
config:
  debug: false
  connect_timeout: 10
  verify_ssl: true
  checksum: true
  dirty: false
  build_jobs: 16
  build_stage: $tempdir/spack-stage
  license_dir: /myriadfs/home/cceahke/Scratch/spack1.2/spack/etc/spack/licenses

Only --scope=defaults:base seems to get all the config, with part of it being

  build_stage:
  - $tempdir/$user/spack-stage
  - $user_cache_path/stage

Need to check that we can properly read and then write out an updated config with the keys we change from using one of these.

Also that this is still necessary at all, given we are putting a new config file into etc/spack/config.yaml as another part of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions