2
0
salt-formula/salt/pkgrepo/suse/install.sls
Imran Iqbal d5320a35ed
fix(pkgrepo/suse/install): avoid managing repo if it already exists
Use ugly `zypper lr --uri` hack to get around failure if the `base_url`
already exists under a different name:

```
      ID: salt-pkgrepo-install-saltstack-suse
Function: pkgrepo.managed
    Name: systemsmanagement_saltstack_products
  Result: False
 Comment: Failed to configure repo 'systemsmanagement_saltstack_products':
          Repository 'systemsmanagement_saltstack_products' already exists as 'systemsmanagement_saltstack'.
 Started: 09:28:39.154054
Duration: 2760.727 ms
```

Upstream code:

* 45cc49daed/salt/modules/zypperpkg.py (L1262-L1265)
2021-01-29 11:23:00 +00:00

18 lines
667 B
Plaintext

# -*- coding: utf-8 -*-
# vim: ft=sls
{% from "salt/map.jinja" import salt_settings with context %}
{#- Resorting to this ugly hack since the state doesn't handle if the `baseurl` is
already configured under another name, such as used by the `salt-bootstrap` #}
{%- if not salt["cmd.run"]("zypper lr --uri | grep " ~ salt_settings.pkgrepo) %}
salt-pkgrepo-install-saltstack-suse:
pkgrepo.managed:
- name: systemsmanagement_saltstack_products
- humanname: {{ salt_settings.pkgrepo_humanname }}
- baseurl: {{ salt_settings.pkgrepo }}
- enabled: 1
- gpgcheck: 1
- gpgkey: {{ salt_settings.key_url }}
- gpgautoimport: true
{%- endif %}