ansible-collections/community.postgresql

have a `comment` argument wherever an object is created

Aberta

#354 aberto em 12 de out. de 2022

 (3 comentários) (3 reações) (0 responsável)Python (116 forks)auto 404
help wanted

Métricas do repositório

Stars
 (142 estrelas)
Métricas de merge de PR
 (Mesclagem média 13d 5h) (3 fundiu PRs em 30d)

Description

  From a user perspective I think it would be more convenient to have a `comment` argument wherever an object is created. To only change a comment, they need to be idempotent. At a quick glance, the argument would suit 11 modules:
  • postgresql_db: #646
  • postgresql_ext: #652
  • postgresql_idx
  • postgresql_lang (deprecated)
  • postgresql_publication: #654
  • postgresql_schema: #650
  • postgresql_sequence
  • postgresql_subscription: #655
  • postgresql_table
  • postgresql_tablespace: #651
  • postgresql_user: #649 (already had the feature, uses the shared function now)
  • add the comment argument value to check_input(...), check across all the modules
  • check reset functionality in all the modules except publication for consistency
  • add check_mode + mogrify to set_comment, fix tests across all the modules where it makes sense

I'd say the benefit of a comment argument or postgresql_comment module over postgresql_query is that we can validate the kind of object which is commented, to avoid SQL injections. As this is part of the query syntax, not a variable, we cannot rely on psycopg2/3 variable escaping.

Originally posted by @betanummeric in https://github.com/ansible-collections/community.postgresql/discussions/352#discussioncomment-3834647

Guia do colaborador