1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/changelogs/fragments
patchback[bot] 9e780b9d5e
Fix macports package present/active detection (#1308) (#1395)
* Fix typo in redhat_subscription testcase

* Fix macports state=present matching against the wrong package name

Previous implementation returned true if the desired package name occurred anywhere in
the list of all installed packages. For example as a substring of another package name,
or even as a substring of a variant name for a different package.

Instead:

- request macports only list installed packages matching the desired package name, instead of all installed packages.
  - Note `port` exits with 0 regardless of whether any packages match the requested name.
- pass `-q` flag: "Do not print the header line. This is useful when parsing the output of port installed in scripts for further processing."
- eliminate `use_unsafe_shell=True` by searching stdout contents natively in python
instead of using `grep`. This has the added benefit of eliminating any potential
misinterpretation of characters in the package name as regex special characters.

If there are zero matching installed packages, `out` is empty.
If there are one or more matches (due to multiple installed versions), the output format
is: ec8a2bc682/src/port/port.tcl (L3320-L3323)

Notably, two leading spaces, the package name, a space, and then other information.
According to blame via github, those lines haven't changed in 11 years.

* Update macports state=active to eliminate use_unsafe_shell

Similar to previous commit (for macports state=present):

- pass `-q` flag: "Do not print the header line. This is useful when parsing the output of port installed in scripts for further processing."
- search stdout contents natively in python instead of using `grep`.
- added parentheses to search string to eliminate false positives if the package name
or variants contain the word `active`. Still could fail if they contain `(active)`, but
that's less likely

If there are zero matching installed packages, `out` is empty.
If there are one or more matches (due to multiple installed versions), the output format
is: ec8a2bc682/src/port/port.tcl (L3320-L3323)

For "state=active", we're looking for a line that contains `(active)` in the output.

* Basic test case of query_port for present and active

* Attempt to fix lint errors in test

* Different mock module creation, changed test cases indentation/spacing

- picked the wrong mock code to cargo-cult. Thanks to felixfontein for this suggestion
- 4 space indentation on continuation line. I thought I had that originally, but it looks like my editor sabotaged me with mixed tabs/spaces
- Remove leading newline on multi-line test cases. I don't think it would make a difference, but I'd read up on how the python syntax works and want to more accurately represent macports output.

fingers crossed this addresses the known build errors

* Add changelog fragment

* Update tests/unit/plugins/modules/packaging/os/test_macports.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/1307-macports-fix-status-check.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit d669e2b60d)

Co-authored-by: Dan Jackson <dan@djackson.org>
2020-11-26 07:15:27 +01:00
..
.keep Rename changelogs/fragments/.empty -> changelogs/fragments/.keep 2020-08-07 08:18:40 +02:00
216-fix-lxc-container-container_config-parameter.yaml lxc_container: fix the type of the 'container_config' parameter (#216) (#1247) 2020-11-08 13:31:21 +01:00
229_lvol_percentage_fix.yml Fix idempotent issue when using lvol with %VG or %PVS size options and VG is fully allocated (#229) (#1250) 2020-11-09 07:49:37 +00:00
349-pacman_improve_group_expansion_speed.yml Improve group expansion speed: query list of pacman groups once (#349) (#349) (#1060) 2020-10-09 13:25:34 +00:00
360_syspatch_apply_patches_by_default.yml OpenBSD Syspatch: Apply patches by default. Minor module cleanup (#360) (#1189) 2020-10-28 07:21:19 +01:00
409-datadog-monitor-include-tags.yaml Add include_tags to datadog_monitor (#409) (#1158) 2020-10-23 07:48:41 +02:00
436-infoblox-use-stderr-and-environment-for-config.yaml infoblox inventory script: Use stderr, and allow use of environment for config (#436) (#1183) 2020-10-27 06:11:43 +01:00
713-maven-timestamp-snapshot.yml maven_artifact: Adjust path for time stamped SNAPSHOT versions (#713) (#1318) 2020-11-16 22:22:14 +01:00
768-facter.yml Added Arguments for Facter module (#768) (#1367) 2020-11-23 19:22:51 +01:00
773-resize-partition.yml Add ability to resize existing partition (#773) (#1348) 2020-11-21 21:38:39 +01:00
788-fix_omapi_host_on_python3.yaml [2.10] Fix omapi_host on python3 (#788) (#1353) 2020-11-22 12:43:09 +01:00
797-proxmox-kvm-cloud-init.yaml Add Cloud Init variables for Proxmox_KVM module (#797) (#1380) 2020-11-24 20:58:28 +01:00
805-docker_image-build-output.yml Add docker build output to task result (#805) (#1306) 2020-11-15 17:08:43 +01:00
823-terraform_init_reconfigure.yaml Add support for "reconfigure" option for terraform init (#823) (#1209) 2020-10-30 21:04:08 +01:00
850-proxmox_kvm-remove_hard_coded_defaults.yml [PR #850/d6f5029 backport][stable-1] proxmox, proxmox_kvm: Deprecate hard-coded defaults (#1205) 2020-11-06 13:16:15 +01:00
886-postgresql_query_add_ret_vals.yml postgresql_query: add query_all_results ret value (#886) (#1131) 2020-10-20 10:37:40 +03:00
968-gitlab_variables-pagination.yml Gitlab variables pagination (#968) (#1063) 2020-10-09 15:30:02 +02:00
993-file-capabilities.yml [capabilities] fix for a newer versions of libcap (#1061) (#1110) 2020-10-16 21:23:43 +02:00
1024-vault-skip-verify-support.yml Respect VAULT_SKIP_VERIFY envionment variable setting in hashi_vault lookup plugin (#1024) (#1062) 2020-10-09 15:30:11 +02:00
1028-proxmox-kvm-linked-clone.yml proxmox_kvm: allow setting format to null (None) (#1028) (#1071) 2020-10-10 12:36:19 +02:00
1036-redis-cache-keyset-name.yaml cache/redis: make keyset keyname configurable (#1036) (#1074) 2020-10-11 20:05:17 +02:00
1038-fix-homebrew-and-homebrew-cask-package-validation.yaml Resolve homebrew and homebrew_cask package name validation issues (#1038) (#1188) 2020-10-28 06:46:35 +01:00
1039-archive-fix-paramater-types.yaml archive: Fix paramater types (#1039) (#1377) 2020-11-24 08:33:19 +01:00
1048-postgresql_privs_add_procedure_type.yml postgresql_privs: add procedure type support (#1048) (#1056) 2020-10-08 09:03:33 +03:00
1055-redis-cache-sentinel.yaml cache/redis: feature redis sentinel (#1055) (#1130) 2020-10-20 10:00:16 +02:00
1059-postgresql_privs_fix_failings_when_using_roles_with_hyphen.yml postgresql_privs: fix module fails when passing roles containing hyphens (#1059) (#1073) 2020-10-11 15:37:52 +03:00
1078-postgresql_ext_fix_version_selection_when_version_is_latest.yml postgresql_ext: sort list of available versions (#1078) (#1084) 2020-10-13 14:53:17 +03:00
1079-redis-use-regexp-to-check-if-the-value-matches-expected-form.yaml redis: use regexp to check if the value matches expected form (#1079) (#1129) 2020-10-20 07:31:20 +02:00
1081-solaris_zone-python3.yml solaris_zone: fix zone configuration with python3 (#1082) (#1096) 2020-10-15 09:52:14 +02:00
1091-postgresql_info_add_in_recovery_ret_val.yml postgresql_info: add in_recovery return value to show if a service in recovery mode or not (#1091) (#1093) 2020-10-14 14:59:21 +03:00
1099-postgresql_ext_fix_failing_when_version_cannot_be_compared.yml postgresql_ext: fix module's failing when available ext versions contain a pure string (#1099) (#1104) 2020-10-16 12:15:54 +03:00
1101-slack-ts-fix.yaml move conversion of data to json in slack API handling (#1101) (#1120) 2020-10-19 11:33:03 +03:00
1105-beadm_bugfix.yaml Unbreak beadm module (#1105) (#1210) 2020-10-31 14:09:43 +01:00
1107-monit-fix-status-check.yml monit: fix module detection of monitored process state (#1107) (#1163) 2020-10-23 14:01:01 +02:00
1118-docker_login-config-store.yml docker_login: fix internal config file storage to handle credentials for more than one registry (#1118) (#1145) 2020-10-21 08:39:57 +02:00
1119-docker_container-device-reqests.yml docker_container: add device_requests option (#1119) (#1186) 2020-10-27 22:43:25 +01:00
1124-pg_hba-dictkey_bugfix.yaml Fix changelog fragment (#1152) (#1153) 2020-10-22 10:44:07 +03:00
1126-influxdb-conditional-path-argument.yml InfluxDB_database: Make the path argument conditional on the InfluxDB version (#1126) (#1236) 2020-11-06 13:48:18 +01:00
1127-maven_artifact_client_cert.yml Added client_cert and client_key to the maven_artifact module. (#1127) (#1142) 2020-10-20 20:27:23 +02:00
1138-hashi_vault_fix_approle_authentication_without_secret_id.yml Fix hashi_vault lookup approle authentication (#1138) (#1315) 2020-11-16 16:40:54 +00:00
1140-iptables_state-fix-race-condition.yml iptables_state: fix race condition between module and its action plugin (#1140) (#1143) 2020-10-20 22:46:12 +02:00
1144-consul-add-tcp-check-support.yml Add TCP healthcheck support for services registered by consul module (#1144) (#1202) 2020-10-30 06:47:59 +01:00
1149-filesystem-fix-355-state-absent.yml filesystem: fix 355 state absent (#1149) (#1184) 2020-10-27 05:47:47 +01:00
1154-django_manage-docs.yml Fixed django_manage markup in docs (#1154) (#1173) 2020-10-26 08:22:10 +01:00
1169-getbinpkgonly.yaml Add getbinpkgonly (-G) to portage (#1169) (#1182) 2020-10-26 21:08:04 +01:00
1175-zypper-absent-lang.yml Fix lang issue on zypper absent (#1175) (#1187) 2020-10-28 06:47:01 +01:00
1179-composer_require_v2_idempotence_fix.yml Issue #1179: Fix v2 composer require idempotence (#1180) (#1181) 2020-10-26 19:54:18 +01:00
1185-proxmox-ignore-qemu-templates.yml proxmox: ignore QEMU templates altogether (#1185) (#1208) 2020-10-30 20:53:06 +01:00
1196-use_description-in-gitlab-group-creation.yml added description parameter to create request (#1196) (#1267) 2020-11-11 13:50:41 +01:00
1206-proxmox-api-token.yml proxmox*: add support for API tokens (#1206) (#1316) 2020-11-16 21:37:42 +01:00
1213-hashi_vault-jwt-auth-support.yaml Add support for HashiCorp Vault JWT auth (#1213) (#1309) 2020-11-16 08:23:44 +01:00
1223-nios-remove-redundant-aliases.yml Remove redundant aliases from NIOS modules (#1223) (#1224) 2020-11-04 08:31:53 +01:00
1243-pkgng-present-ignoreosver.yaml [pkgng] present the 'ignore_osver' option to pkg (#1243) (#1321) 2020-11-17 07:37:00 +01:00
1244-renamed-parameter.yaml Changed parameter name, added aliases for compatibility. (#1244) (#1248) 2020-11-09 07:16:20 +01:00
1246-flatpak-use-non-interactive-argument.yaml Add --non-interactive argurment to Flatpak (#1246) (#1332) 2020-11-19 21:31:36 +01:00
1256-feat-pkgin-add-full-version-package-name.yml feat(pkgin): add support for installation of full versioned package names (#1256) (#1349) 2020-11-21 21:41:09 +01:00
1258-proxmox_kvm-ignore-pool-on-update.yaml proxmox_kvm: pool parameter not supported by qemu/<vmid>/config API endpoint (#1258) (#1300) 2020-11-14 12:33:14 +01:00
1264-dict_kv-new-filter.yaml Add filter dict_kv (#1264) (#1374) 2020-11-24 06:23:37 +01:00
1270-linode-v4-stackscript-support.yaml Add support for StackScripts to Linode v4 module (#1270) (#1288) 2020-11-13 12:59:28 +01:00
1305-added-xfconf-tests.yaml Xfconf tests (#1305) (#1313) 2020-11-16 12:49:38 +01:00
1307-macports-fix-status-check.yml Fix macports package present/active detection (#1308) (#1395) 2020-11-26 07:15:27 +01:00
1322-module_helper_and_xfconf.yaml Adding module_utils/module_helper.py + big revamp in xfconf.py to use it (#1322) (#1336) 2020-11-20 12:43:23 +01:00
1331-proxmox-info-modules.yml proxmox: create a common base (#1331) (#1378) 2020-11-24 17:56:50 +01:00
1338-datadog-mark-notification_message-no_log.yml Datadog: Mark notification_message as no_log (#1338) (#1385) 2020-11-25 08:01:17 +01:00
1339-ip-no_log-nonsecret.yml ipa: Update non-secret fields matching '*pass*' with no_log=False (#1339) (#1345) 2020-11-21 17:36:40 +01:00
community.docker-31-docker-secret.yml Add a warning when ansible_key label is not found on a secret. (#31) (#1249) (#1251) 2020-11-09 08:56:26 +01:00
docker-migration.yml Improve fragments. (#1381) 2020-11-25 08:03:40 +01:00
fix-plugin-imports.yml Fix gcp_storage_file lookup plugin (#1284). 2020-11-13 22:06:46 +01:00
hetzner-migration.yml Improve fragments. (#1381) 2020-11-25 08:03:40 +01:00
lookup-passwordstore-umask.yml Added umask option to passwordstore lookup plugin. (#1156) (#1376) 2020-11-24 07:36:15 +00:00
nmcli-refactor.yml nmcli: module refactor (#1113) (#1159) 2020-10-23 07:48:29 +02:00
odbc.yml odbc: adding parameter to disable auto-commit (#1137) (#1139) (#1240) 2020-11-06 21:18:59 +01:00
openbsd_pkg.yml Add OpenBSD pkg_add(1) snapshot support (#965) (#1280) 2020-11-13 06:49:59 +00:00
postgresql-migration.yml Add changelog fragment with PostgreSQL migration announcement (#1384) 2020-11-25 08:24:26 +01:00
proxmox_template-appliance-download.yml proxmox_template download appliance templates (#1046) (#1230) 2020-11-05 06:49:07 +01:00
remove-ansible.posix-dependency.yml Remove ansible.posix dependency (#1157) (#1191) 2020-10-28 20:57:07 +01:00