Page MenuHomePhabricator

WMCS standalone puppet master does not lookup cherry picked hiera change
Closed, ResolvedPublic


deployment-prep uses a standalone puppetmaster, when cherry picking a patch that affects hieradata the change is not reflected.

I have cherry picked on deployment-puppetmaster04.deployment-prep.eqiad.wmflabs which adds:

    - version: 11
      variant: jre-headless

The new value is not found, it ends up to fallback on the default: []

Puppet hierarchy is:

version: 5
  datadir: /etc/puppet/hieradata
  data_hash: yaml_data
  - name: 'Http Yaml'
    data_hash: cloudlib::httpyaml
    uri: "{::labsproject}/node/%{facts.fqdn}"
  - name: "cloud hierarchy"
      - "cloud/%{::wmcs_deployment}/%{::labsproject}/hosts/%{::hostname}.yaml"
      - "cloud/%{::wmcs_deployment}/%{::labsproject}/common.yaml"
      - "cloud/%{::wmcs_deployment}.yaml"
      - "cloud.yaml"
  - name: "Secret hierarchy"
    path: "%{::labsproject}.yaml"
    datadir: "/etc/puppet/secret/hieradata"
  - name: "Private hierarchy"
      - "labs/%{::labsproject}/common.yaml"
      - "%{::labsproject}.yaml"
      - "labs.yaml"
    datadir: "/etc/puppet/private/hieradata"
  - name: "Common hierarchy"
    path: "common.yaml"
  - name: "Secret Common hierarchy"
    path: "common.yaml"
    datadir: "/etc/puppet/secret/hieradata"
  - name: "Private Common hierarchy"
    path: "common.yaml"
    datadir: "/etc/puppet/private/hieradata"

If I look it up on deployment-puppetmaster04:

sudo puppet lookup --compile --explain --node deployment-deploy01.deployment-prep.eqiad.wmflabs profile::java::java_packages
Warning: Undefined variable 'puppetmaster'; \n   (file & line not available)
Warning: Unknown variable: 'profile::backup::host::jobdefaults'. (file: /etc/puppet/modules/backup/manifests/set.pp, line: 10, column: 33)
Warning: Unknown variable: 'profile::backup::host::jobdefaults'. (file: /etc/puppet/modules/backup/manifests/set.pp, line: 10, column: 33)

Searching for "profile::java::java_packages"
  Global Data Provider (hiera configuration version 5)
    Using configuration "/etc/puppet/hiera.yaml"

    Hierarchy entry "Http Yaml"

      URI ""
        Original uri: "{::labsproject}/node/%{facts.fqdn}"
        No such key: "profile::java::java_packages"

    Hierarchy entry "cloud hierarchy"

      Path "/etc/puppet/hieradata/cloud/eqiad1/deployment-prep/hosts/deployment-deploy01.yaml"
        Original path: "cloud/%{::wmcs_deployment}/%{::labsproject}/hosts/%{::hostname}.yaml"
        Path not found

      Path "/etc/puppet/hieradata/cloud/eqiad1/deployment-prep/common.yaml"
        Original path: "cloud/%{::wmcs_deployment}/%{::labsproject}/common.yaml"
        No such key: "profile::java::java_packages"

      Path "/etc/puppet/hieradata/cloud/eqiad1.yaml"
        Original path: "cloud/%{::wmcs_deployment}.yaml"
        No such key: "profile::java::java_packages"

      Path "/etc/puppet/hieradata/cloud.yaml"
        Original path: "cloud.yaml"
        Found key: "profile::java::java_packages" value: []

Or in other words, it does not seem to search /etc/hieradata/common.

Apparently caused by the migration to hiera 5 by @jbond , previously we had:

  datadir: /etc/puppet/hieradata
  - "common"

I guess if the patch is merged, the lookup will be found via

The workaround for the cherry-pick to work would be to use the generic /etc/puppet/hieradata/cloud.yaml instead of /etc/puppet/hieradata/common/profile/ci/slave/labs/common.yaml .

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

@hashar tl;dr the you should place the value in hieradata/cloud.yaml to set a sane default for all cloud projects and hieradata/cloud/eqiad1/deployment-prep/common.yaml to override in deployment-prep

This is not related to the hiera5 switch but more related the differences between cloud-vps and prod hiera lookups, specificity cloud vps hiera dose not use wmflib::expand_path, in hiera3 this was the equivalent of the nuyaml3 expand_path config which never existed in labs, in fact labs was still using nuyaml vs nuyaml3 which potentially didn't even support expand_paths (before my time)

I just misunderstood how hiera lookup works on WMCS. The bulk of it is that parameters specific to profiles are never looked up since commons directory is not part of the hierarchy.

My use case is that for hosts having profile::ci::slave::labs::common, I would like to set:

    - version: 11
      variant: jre-headless

Maybe I can just set it project wide for the integration and puppet-diffs project since there are no other use cases for Java.

For deployment-prep that would surely cause some troubles here and there when java_packages is already defined or when some profile already set it to use Java 8. I guess I can do it on a per host based (solely deployment-deploy01 instance would need it).

Change 673286 had a related patch set uploaded (by Hashar; owner: Hashar):
[operations/puppet@production] contint: remove erroneous hiera setting for labs

hashar claimed this task.

Thank you @jbond !

Change 673286 merged by Dzahn:

[operations/puppet@production] contint: remove erroneous hiera setting for labs