Browse Source

Make from_fqdn accept dashes in app name

remotes/origin/master
Sean Johnson 3 years ago
parent
commit
464b2051ec
  1. 1
      .gitattributes
  2. 0
      README.md
  3. 8
      _grains/from_fqdn.py
  4. 0
      app/cfdd/_macros.j2
  5. 0
      app/cfdd/defaults.yaml
  6. 0
      app/cfdd/init.sls
  7. 0
      app/cfdd/install.sls
  8. 0
      app/cfdd/map.jinja
  9. 0
      app/cfdd/service.sls
  10. 0
      app/cfdd/templates/cfdd@.service.j2
  11. 0
      app/concourse_worker/defaults.yaml
  12. 0
      app/concourse_worker/init.sls
  13. 0
      app/concourse_worker/map.jinja
  14. 0
      app/consul/ca.sls
  15. 0
      app/consul/tls.sls
  16. 0
      app/docker/config.sls
  17. 0
      app/docker/init.sls
  18. 0
      app/docker/pip_docker.sls
  19. 0
      app/docker/tls.sls
  20. 0
      app/grainsrv/defaults.yaml
  21. 0
      app/grainsrv/init.sls
  22. 0
      app/grainsrv/map.jinja
  23. 0
      app/letsencrypt.sls
  24. 0
      app/logspout/defaults.yaml
  25. 0
      app/logspout/init.sls
  26. 0
      app/logspout/map.jinja
  27. 0
      app/nginx_proxy/defaults.yaml
  28. 0
      app/nginx_proxy/init.sls
  29. 0
      app/nginx_proxy/map.jinja
  30. 0
      app/saltbot/defaults.yaml
  31. 0
      app/saltbot/init.sls
  32. 0
      app/saltbot/map.jinja
  33. 0
      app/vault.sls
  34. 0
      base/debian_packages.sls
  35. 0
      base/files.sls
  36. 0
      base/files/ld-root-ca.crt
  37. 0
      base/files/motd.txt
  38. 0
      base/init.sls
  39. 0
      base/map.jinja
  40. 0
      base/package_map.yaml
  41. 0
      base/packages.sls
  42. 0
      base/python.sls
  43. 0
      base/repositories.sls
  44. 0
      base/sshd.sls
  45. 0
      base/templates/20auto-upgrades.j2
  46. 0
      base/templates/50unattended-upgrades.j2
  47. 0
      base/unattended_upgrades.sls
  48. 0
      ci/pipeline.yml
  49. 0
      ci/settings.yml
  50. 0
      engines/logdna.sls
  51. 0
      saltbox/master.sls
  52. 0
      saltbox/minion.sls
  53. 0
      saltbox/orchestrator/logdna_alert/init.sls
  54. 0
      saltbox/orchestrator/templates/orch_logdna_alert.j2
  55. 0
      saltbox/orchestrator/templates/orch_update_fileserver.j2
  56. 0
      saltbox/orchestrator/templates/reactor_logdna_alert.j2
  57. 0
      saltbox/orchestrator/templates/reactor_update_fileserver.j2
  58. 0
      saltbox/orchestrator/update_fileserver/init.sls
  59. 0
      saltbox/reactor/sync_grains.sls
  60. 0
      saltbox/reactor/telegram_notify.sls
  61. 0
      saltbox/reactor/templates/sync_grains.j2
  62. 0
      saltbox/reactor/templates/telegram_notify.j2
  63. 0
      saltbox/templates/master.d/api.j2
  64. 0
      saltbox/templates/master.d/engines.j2
  65. 0
      saltbox/templates/master.d/external_auth.j2
  66. 0
      saltbox/templates/master.d/fileserver.j2
  67. 0
      saltbox/templates/master.d/gitfs.j2
  68. 0
      saltbox/templates/master.d/logging.j2
  69. 0
      saltbox/templates/master.d/pillar.j2
  70. 0
      saltbox/templates/master.d/reactor.j2
  71. 0
      saltbox/templates/minion.d/from_fqdn.j2
  72. 0
      saltbox/templates/minion.d/grainsrv.j2
  73. 0
      saltbox/templates/minion.d/mine.j2
  74. 0
      top.sls

1
.gitattributes vendored

@ -0,0 +1 @@
* text eol=lf

8
_grains/from_fqdn.py

@ -9,7 +9,7 @@ import socket
__virtualname__ = "from_fqdn"
_regex = re.compile(r"""
^ # beginning of string
(?P<app>[a-z_]+) # matches the app name
(?P<app>[a-z_-]+) # matches the app name
- # separator between app name and node num
n(?P<node>\d{2,}) # match node num w/o leading `n`
\. # next domain part
@ -68,7 +68,7 @@ def _grains_from_fqdn(cfg):
hostname = _get_hostname(cfg)
rematch = _regex.search(hostname)
grains = {
return {
"app": rematch.group("app"),
"node": rematch.group("node"),
"datacenter": rematch.group("datacenter"),
@ -76,8 +76,6 @@ def _grains_from_fqdn(cfg):
"parent_domain": rematch.group("domain"),
}
return grains
def main():
@ -88,4 +86,4 @@ def main():
if __name__ == "__main__":
import pprint
pprint.pprint(_grains_from_fqdn(_get_config()))
pprint.pprint(_grains_from_fqdn(_get_config({})))

0
app/cfdd/_macros.j2

0
app/cfdd/defaults.yaml

0
app/cfdd/init.sls

0
app/cfdd/install.sls

0
app/cfdd/map.jinja

0
app/cfdd/service.sls

0
app/cfdd/templates/cfdd@.service.j2

0
app/concourse_worker/defaults.yaml

0
app/concourse_worker/init.sls

0
app/concourse_worker/map.jinja

0
app/consul/ca.sls

0
app/consul/tls.sls

0
app/docker/config.sls

0
app/docker/init.sls

0
app/docker/pip_docker.sls

0
app/docker/tls.sls

0
app/grainsrv/defaults.yaml

0
app/grainsrv/init.sls

0
app/grainsrv/map.jinja

0
app/letsencrypt.sls

0
app/logspout/defaults.yaml

0
app/logspout/init.sls

0
app/logspout/map.jinja

0
app/nginx_proxy/defaults.yaml

0
app/nginx_proxy/init.sls

0
app/nginx_proxy/map.jinja

0
app/saltbot/defaults.yaml

0
app/saltbot/init.sls

0
app/saltbot/map.jinja

0
app/vault.sls

0
base/debian_packages.sls

0
base/files.sls

0
base/files/ld-root-ca.crt

0
base/files/motd.txt

0
base/init.sls

0
base/map.jinja

0
base/package_map.yaml

0
base/packages.sls

0
base/python.sls

0
base/repositories.sls

0
base/sshd.sls

0
base/templates/20auto-upgrades.j2

0
base/templates/50unattended-upgrades.j2

0
base/unattended_upgrades.sls

0
ci/pipeline.yml

0
ci/settings.yml

0
engines/logdna.sls

0
saltbox/master.sls

0
saltbox/minion.sls

0
saltbox/orchestrator/logdna_alert/init.sls

0
saltbox/orchestrator/templates/orch_logdna_alert.j2

0
saltbox/orchestrator/templates/orch_update_fileserver.j2

0
saltbox/orchestrator/templates/reactor_logdna_alert.j2

0
saltbox/orchestrator/templates/reactor_update_fileserver.j2

0
saltbox/orchestrator/update_fileserver/init.sls

0
saltbox/reactor/sync_grains.sls

0
saltbox/reactor/telegram_notify.sls

0
saltbox/reactor/templates/sync_grains.j2

0
saltbox/reactor/templates/telegram_notify.j2

0
saltbox/templates/master.d/api.j2

0
saltbox/templates/master.d/engines.j2

0
saltbox/templates/master.d/external_auth.j2

0
saltbox/templates/master.d/fileserver.j2

0
saltbox/templates/master.d/gitfs.j2

0
saltbox/templates/master.d/logging.j2

0
saltbox/templates/master.d/pillar.j2

0
saltbox/templates/master.d/reactor.j2

0
saltbox/templates/minion.d/from_fqdn.j2

0
saltbox/templates/minion.d/grainsrv.j2

0
saltbox/templates/minion.d/mine.j2

Loading…
Cancel
Save