Created
April 28, 2022 07:23
-
-
Save strus38/b1d51003688e796b6de4c0664cd1f88a to your computer and use it in GitHub Desktop.
to_fqdn allows to mass change your ansible repo to support ansible FQDNs modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import fnmatch | |
import sys | |
import shutil | |
import re | |
MODULES_LIST=[ | |
"ansible.builtin.add_host:", | |
"ansible.builtin.apt:", | |
"ansible.builtin.apt_key:", | |
"ansible.builtin.apt_repository:", | |
"ansible.builtin.assemble:", | |
"ansible.builtin.assert:", | |
"ansible.builtin.async_status:", | |
"ansible.builtin.blockinfile:", | |
"ansible.builtin.command:", | |
"ansible.builtin.copy:", | |
"ansible.builtin.cron:", | |
"ansible.builtin.debconf:", | |
"ansible.builtin.debug:", | |
"ansible.builtin.dnf:", | |
"ansible.builtin.dpkg_selections:", | |
"ansible.builtin.expect:", | |
"ansible.builtin.fail:", | |
"ansible.builtin.fetch:", | |
"ansible.builtin.file:", | |
"ansible.builtin.find:", | |
"ansible.builtin.gather_facts:", | |
"ansible.builtin.get_url:", | |
"ansible.builtin.getent:", | |
"ansible.builtin.git:", | |
# "ansible.builtin.group:", | |
"ansible.builtin.group_by:", | |
"ansible.builtin.hostname:", | |
"ansible.builtin.import_playbook:", | |
"ansible.builtin.import_role:", | |
"ansible.builtin.import_tasks:", | |
"ansible.builtin.include:", | |
"ansible.builtin.include_role:", | |
"ansible.builtin.include_tasks:", | |
"ansible.builtin.include_vars:", | |
"ansible.builtin.iptables:", | |
"ansible.builtin.known_hosts:", | |
"ansible.builtin.lineinfile:", | |
"ansible.builtin.meta:", | |
"ansible.builtin.package:", | |
"ansible.builtin.package_facts:", | |
"ansible.builtin.pause:", | |
"ansible.builtin.ping:", | |
"ansible.builtin.pip:", | |
"ansible.builtin.raw:", | |
"ansible.builtin.reboot:", | |
"ansible.builtin.replace:", | |
"ansible.builtin.rpm_key:", | |
"ansible.builtin.script:", | |
"ansible.builtin.service:", | |
"ansible.builtin.service_facts:", | |
"ansible.builtin.set_fact:", | |
"ansible.builtin.set_stats:", | |
"ansible.builtin.setup:", | |
"ansible.builtin.shell:", | |
"ansible.builtin.slurp:", | |
"ansible.builtin.stat:", | |
"ansible.builtin.subversion:", | |
"ansible.builtin.systemd:", | |
"ansible.builtin.sysvinit:", | |
"ansible.builtin.tempfile:", | |
"ansible.builtin.template:", | |
"ansible.builtin.unarchive:", | |
"ansible.builtin.uri:", | |
"ansible.builtin.user:", | |
"ansible.builtin.validate_argument_spec:", | |
"ansible.builtin.wait_for:", | |
"ansible.builtin.wait_for_connection:", | |
"ansible.builtin.yum:", | |
"ansible.builtin.yum_repository:", | |
"ansible.posix.acl:", | |
"ansible.posix.authorized_key:", | |
"ansible.posix.firewalld:", | |
"ansible.posix.firewalld_info:", | |
"ansible.posix.mount:", | |
"ansible.posix.patch:", | |
"ansible.posix.seboolean:", | |
"ansible.posix.selinux:", | |
"ansible.posix.synchronize:", | |
"ansible.posix.sysctl:", | |
"kubernetes.core.helm:", | |
"kubernetes.core.helm_info:", | |
"kubernetes.core.helm_plugin:", | |
"kubernetes.core.helm_plugin_info:", | |
"kubernetes.core.helm_repository:", | |
"kubernetes.core.helm_template:", | |
"kubernetes.core.k8s:", | |
"kubernetes.core.k8s_cluster_info:", | |
"kubernetes.core.k8s_cp:", | |
"kubernetes.core.k8s_drain:", | |
"kubernetes.core.k8s_exec:", | |
"kubernetes.core.k8s_info:", | |
"kubernetes.core.k8s_json_patch:", | |
"kubernetes.core.k8s_log:", | |
"kubernetes.core.k8s_rollback:", | |
"kubernetes.core.k8s_scale:", | |
"kubernetes.core.k8s_service:", | |
"kubernetes.core.k8s_taint:", | |
"community.general.aerospike_migrations:", | |
"community.general.airbrake_deployment:", | |
"community.general.aix_devices:", | |
"community.general.aix_filesystem:", | |
"community.general.aix_inittab:", | |
"community.general.aix_lvg:", | |
"community.general.aix_lvol:", | |
"community.general.alerta_customer:", | |
"community.general.ali_instance:", | |
"community.general.ali_instance_info:", | |
"community.general.alternatives:", | |
"community.general.ansible_galaxy_install:", | |
"community.general.apache2_mod_proxy:", | |
"community.general.apache2_module:", | |
"community.general.apk:", | |
"community.general.apt_repo:", | |
"community.general.apt_rpm:", | |
"community.general.archive:", | |
"community.general.atomic_container:", | |
"community.general.atomic_host:", | |
"community.general.atomic_image:", | |
"community.general.awall:", | |
"community.general.beadm:", | |
"community.general.bearychat:", | |
"community.general.bigpanda:", | |
"community.general.bitbucket_access_key:", | |
"community.general.bitbucket_pipeline_key_pair:", | |
"community.general.bitbucket_pipeline_known_host:", | |
"community.general.bitbucket_pipeline_variable:", | |
"community.general.bower:", | |
"community.general.bundler:", | |
"community.general.bzr:", | |
"community.general.campfire:", | |
"community.general.capabilities:", | |
"community.general.cargo:", | |
"community.general.catapult:", | |
"community.general.circonus_annotation:", | |
"community.general.cisco_webex:", | |
"community.general.clc_aa_policy:", | |
"community.general.clc_alert_policy:", | |
"community.general.clc_blueprint_package:", | |
"community.general.clc_firewall_policy:", | |
"community.general.clc_group:", | |
"community.general.clc_loadbalancer:", | |
"community.general.clc_modify_server:", | |
"community.general.clc_publicip:", | |
"community.general.clc_server:", | |
"community.general.clc_server_snapshot:", | |
"community.general.cloud_init_data_facts:", | |
"community.general.cloudflare_dns:", | |
"community.general.cobbler_sync:", | |
"community.general.cobbler_system:", | |
"community.general.composer:", | |
"community.general.consul:", | |
"community.general.consul_acl:", | |
"community.general.consul_kv:", | |
"community.general.consul_session:", | |
"community.general.copr:", | |
"community.general.cpanm:", | |
"community.general.cronvar:", | |
"community.general.crypttab:", | |
"community.general.datadog_downtime:", | |
"community.general.datadog_event:", | |
"community.general.datadog_monitor:", | |
"community.general.dconf:", | |
"community.general.deploy_helper:", | |
"community.general.dimensiondata_network:", | |
"community.general.dimensiondata_vlan:", | |
"community.general.discord:", | |
"community.general.django_manage:", | |
"community.general.dnf_versionlock:", | |
"community.general.dnsimple:", | |
"community.general.dnsimple_info:", | |
"community.general.dnsmadeeasy:", | |
"community.general.dpkg_divert:", | |
"community.general.easy_install:", | |
"community.general.ejabberd_user:", | |
"community.general.elasticsearch_plugin:", | |
"community.general.emc_vnx_sg_member:", | |
"community.general.etcd3:", | |
"community.general.facter:", | |
"community.general.filesize:", | |
"community.general.filesystem:", | |
"community.general.flatpak:", | |
"community.general.flatpak_remote:", | |
"community.general.flowdock:", | |
"community.general.gandi_livedns:", | |
"community.general.gconftool2:", | |
"community.general.gem:", | |
"community.general.git_config:", | |
"community.general.github_deploy_key:", | |
"community.general.github_issue:", | |
"community.general.github_key:", | |
"community.general.github_release:", | |
"community.general.github_repo:", | |
"community.general.github_webhook:", | |
"community.general.github_webhook_info:", | |
"community.general.gitlab_branch:", | |
"community.general.gitlab_deploy_key:", | |
"community.general.gitlab_group:", | |
"community.general.gitlab_group_members:", | |
"community.general.gitlab_group_variable:", | |
"community.general.gitlab_hook:", | |
"community.general.gitlab_project:", | |
"community.general.gitlab_project_members:", | |
"community.general.gitlab_project_variable:", | |
"community.general.gitlab_protected_branch:", | |
"community.general.gitlab_runner:", | |
"community.general.gitlab_user:", | |
"community.general.grove:", | |
"community.general.gunicorn:", | |
"community.general.hana_query:", | |
"community.general.haproxy:", | |
"community.general.heroku_collaborator:", | |
"community.general.hg:", | |
"community.general.hipchat:", | |
"community.general.homebrew:", | |
"community.general.homebrew_cask:", | |
"community.general.homebrew_tap:", | |
"community.general.homectl:", | |
"community.general.honeybadger_deployment:", | |
"community.general.hpilo_boot:", | |
"community.general.hpilo_info:", | |
"community.general.hponcfg:", | |
"community.general.htpasswd:", | |
"community.general.hwc_ecs_instance:", | |
"community.general.hwc_evs_disk:", | |
"community.general.hwc_network_vpc:", | |
"community.general.hwc_smn_topic:", | |
"community.general.hwc_vpc_eip:", | |
"community.general.hwc_vpc_peering_connect:", | |
"community.general.hwc_vpc_port:", | |
"community.general.hwc_vpc_private_ip:", | |
"community.general.hwc_vpc_route:", | |
"community.general.hwc_vpc_security_group:", | |
"community.general.hwc_vpc_security_group_rule:", | |
"community.general.hwc_vpc_subnet:", | |
"community.general.ibm_sa_domain:", | |
"community.general.ibm_sa_host:", | |
"community.general.ibm_sa_host_ports:", | |
"community.general.ibm_sa_pool:", | |
"community.general.ibm_sa_vol:", | |
"community.general.ibm_sa_vol_map:", | |
"community.general.icinga2_feature:", | |
"community.general.icinga2_host:", | |
"community.general.idrac_redfish_command:", | |
"community.general.idrac_redfish_config:", | |
"community.general.idrac_redfish_info:", | |
"community.general.ilo_redfish_config:", | |
"community.general.ilo_redfish_info:", | |
"community.general.imc_rest:", | |
"community.general.imgadm:", | |
"community.general.infinity:", | |
"community.general.influxdb_database:", | |
"community.general.influxdb_query:", | |
"community.general.influxdb_retention_policy:", | |
"community.general.influxdb_user:", | |
"community.general.influxdb_write:", | |
"community.general.ini_file:", | |
"community.general.installp:", | |
"community.general.interfaces_file:", | |
"community.general.ip_netns:", | |
"community.general.ipa_config:", | |
"community.general.ipa_dnsrecord:", | |
"community.general.ipa_dnszone:", | |
"community.general.ipa_group:", | |
"community.general.ipa_hbacrule:", | |
"community.general.ipa_host:", | |
"community.general.ipa_hostgroup:", | |
"community.general.ipa_otpconfig:", | |
"community.general.ipa_otptoken:", | |
"community.general.ipa_pwpolicy:", | |
"community.general.ipa_role:", | |
"community.general.ipa_service:", | |
"community.general.ipa_subca:", | |
"community.general.ipa_sudocmd:", | |
"community.general.ipa_sudocmdgroup:", | |
"community.general.ipa_sudorule:", | |
"community.general.ipa_user:", | |
"community.general.ipa_vault:", | |
"community.general.ipify_facts:", | |
"community.general.ipinfoio_facts:", | |
"community.general.ipmi_boot:", | |
"community.general.ipmi_power:", | |
"community.general.iptables_state:", | |
"community.general.ipwcli_dns:", | |
"community.general.irc:", | |
"community.general.iso_create:", | |
"community.general.iso_extract:", | |
"community.general.jabber:", | |
"community.general.java_cert:", | |
"community.general.java_keystore:", | |
"community.general.jboss:", | |
"community.general.jenkins_build:", | |
"community.general.jenkins_job:", | |
"community.general.jenkins_job_info:", | |
"community.general.jenkins_plugin:", | |
"community.general.jenkins_script:", | |
"community.general.jira:", | |
"community.general.kernel_blacklist:", | |
"community.general.keycloak_authentication:", | |
"community.general.keycloak_client:", | |
"community.general.keycloak_client_rolemapping:", | |
"community.general.keycloak_clientscope:", | |
"community.general.keycloak_clienttemplate:", | |
"community.general.keycloak_group:", | |
"community.general.keycloak_identity_provider:", | |
"community.general.keycloak_realm:", | |
"community.general.keycloak_realm_info:", | |
"community.general.keycloak_role:", | |
"community.general.keycloak_user_federation:", | |
"community.general.kibana_plugin:", | |
"community.general.launchd:", | |
"community.general.layman:", | |
"community.general.lbu:", | |
"community.general.ldap_attrs:", | |
"community.general.ldap_entry:", | |
"community.general.ldap_passwd:", | |
"community.general.ldap_search:", | |
"community.general.librato_annotation:", | |
"community.general.linode:", | |
"community.general.linode_v4:", | |
"community.general.listen_ports_facts:", | |
"community.general.lldp:", | |
"community.general.locale_gen:", | |
"community.general.logentries:", | |
"community.general.logentries_msg:", | |
"community.general.logstash_plugin:", | |
"community.general.lvg:", | |
"community.general.lvol:", | |
"community.general.lxc_container:", | |
"community.general.lxca_cmms:", | |
"community.general.lxca_nodes:", | |
"community.general.lxd_container:", | |
"community.general.lxd_profile:", | |
"community.general.lxd_project:", | |
"community.general.macports:", | |
"community.general.mail:", | |
"community.general.make:", | |
"community.general.manageiq_alert_profiles:", | |
"community.general.manageiq_alerts:", | |
"community.general.manageiq_group:", | |
"community.general.manageiq_policies:", | |
"community.general.manageiq_provider:", | |
"community.general.manageiq_tags:", | |
"community.general.manageiq_tenant:", | |
"community.general.manageiq_user:", | |
"community.general.mas:", | |
"community.general.matrix:", | |
"community.general.mattermost:", | |
"community.general.maven_artifact:", | |
"community.general.memset_dns_reload:", | |
"community.general.memset_memstore_info:", | |
"community.general.memset_server_info:", | |
"community.general.memset_zone:", | |
"community.general.memset_zone_domain:", | |
"community.general.memset_zone_record:", | |
"community.general.mksysb:", | |
"community.general.modprobe:", | |
"community.general.monit:", | |
"community.general.mqtt:", | |
"community.general.mssql_db:", | |
"community.general.mssql_script:", | |
"community.general.nagios:", | |
"community.general.netcup_dns:", | |
"community.general.newrelic_deployment:", | |
"community.general.nexmo:", | |
"community.general.nginx_status_info:", | |
"community.general.nictagadm:", | |
"community.general.nmcli:", | |
"community.general.nomad_job:", | |
"community.general.nomad_job_info:", | |
"community.general.nosh:", | |
"community.general.npm:", | |
"community.general.nsupdate:", | |
"community.general.oci_vcn:", | |
"community.general.odbc:", | |
"community.general.office_365_connector_card:", | |
"community.general.ohai:", | |
"community.general.omapi_host:", | |
"community.general.one_host:", | |
"community.general.one_image:", | |
"community.general.one_image_info:", | |
"community.general.one_service:", | |
"community.general.one_template:", | |
"community.general.one_vm:", | |
"community.general.oneandone_firewall_policy:", | |
"community.general.oneandone_load_balancer:", | |
"community.general.oneandone_monitoring_policy:", | |
"community.general.oneandone_private_network:", | |
"community.general.oneandone_public_ip:", | |
"community.general.oneandone_server:", | |
"community.general.onepassword_info:", | |
"community.general.oneview_datacenter_info:", | |
"community.general.oneview_enclosure_info:", | |
"community.general.oneview_ethernet_network:", | |
"community.general.oneview_ethernet_network_info:", | |
"community.general.oneview_fc_network:", | |
"community.general.oneview_fc_network_info:", | |
"community.general.oneview_fcoe_network:", | |
"community.general.oneview_fcoe_network_info:", | |
"community.general.oneview_logical_interconnect_group:", | |
"community.general.oneview_logical_interconnect_group_info:", | |
"community.general.oneview_network_set:", | |
"community.general.oneview_network_set_info:", | |
"community.general.oneview_san_manager:", | |
"community.general.oneview_san_manager_info:", | |
"community.general.online_server_info:", | |
"community.general.online_user_info:", | |
"community.general.open_iscsi:", | |
"community.general.openbsd_pkg:", | |
"community.general.opendj_backendprop:", | |
"community.general.openwrt_init:", | |
"community.general.opkg:", | |
"community.general.osx_defaults:", | |
"community.general.ovh_ip_failover:", | |
"community.general.ovh_ip_loadbalancing_backend:", | |
"community.general.ovh_monthly_billing:", | |
"community.general.pacemaker_cluster:", | |
"community.general.packet_device:", | |
"community.general.packet_ip_subnet:", | |
"community.general.packet_project:", | |
"community.general.packet_sshkey:", | |
"community.general.packet_volume:", | |
"community.general.packet_volume_attachment:", | |
"community.general.pacman:", | |
"community.general.pacman_key:", | |
"community.general.pagerduty:", | |
"community.general.pagerduty_alert:", | |
"community.general.pagerduty_change:", | |
"community.general.pagerduty_user:", | |
"community.general.pam_limits:", | |
"community.general.pamd:", | |
"community.general.parted:", | |
"community.general.pear:", | |
"community.general.pids:", | |
"community.general.pingdom:", | |
"community.general.pip_package_info:", | |
"community.general.pipx:", | |
"community.general.pkg5:", | |
"community.general.pkg5_publisher:", | |
"community.general.pkgin:", | |
"community.general.pkgng:", | |
"community.general.pkgutil:", | |
"community.general.pmem:", | |
"community.general.portage:", | |
"community.general.portinstall:", | |
"community.general.pritunl_org:", | |
"community.general.pritunl_org_info:", | |
"community.general.pritunl_user:", | |
"community.general.pritunl_user_info:", | |
"community.general.profitbricks:", | |
"community.general.profitbricks_datacenter:", | |
"community.general.profitbricks_nic:", | |
"community.general.profitbricks_volume:", | |
"community.general.profitbricks_volume_attachments:", | |
"community.general.proxmox:", | |
"community.general.proxmox_domain_info:", | |
"community.general.proxmox_group_info:", | |
"community.general.proxmox_kvm:", | |
"community.general.proxmox_nic:", | |
"community.general.proxmox_snap:", | |
"community.general.proxmox_storage_info:", | |
"community.general.proxmox_tasks_info:", | |
"community.general.proxmox_template:", | |
"community.general.proxmox_user_info:", | |
"community.general.pubnub_blocks:", | |
"community.general.pulp_repo:", | |
"community.general.puppet:", | |
"community.general.pushbullet:", | |
"community.general.pushover:", | |
"community.general.python_requirements_info:", | |
"community.general.rax:", | |
"community.general.rax_cbs:", | |
"community.general.rax_cbs_attachments:", | |
"community.general.rax_cdb:", | |
"community.general.rax_cdb_database:", | |
"community.general.rax_cdb_user:", | |
"community.general.rax_clb:", | |
"community.general.rax_clb_nodes:", | |
"community.general.rax_clb_ssl:", | |
"community.general.rax_dns:", | |
"community.general.rax_dns_record:", | |
"community.general.rax_facts:", | |
"community.general.rax_files:", | |
"community.general.rax_files_objects:", | |
"community.general.rax_identity:", | |
"community.general.rax_keypair:", | |
"community.general.rax_meta:", | |
"community.general.rax_mon_alarm:", | |
"community.general.rax_mon_check:", | |
"community.general.rax_mon_entity:", | |
"community.general.rax_mon_notification:", | |
"community.general.rax_mon_notification_plan:", | |
"community.general.rax_network:", | |
"community.general.rax_queue:", | |
"community.general.rax_scaling_group:", | |
"community.general.rax_scaling_policy:", | |
"community.general.read_csv:", | |
"community.general.redfish_command:", | |
"community.general.redfish_config:", | |
"community.general.redfish_info:", | |
"community.general.redhat_subscription:", | |
"community.general.redis:", | |
"community.general.redis_data:", | |
"community.general.redis_data_incr:", | |
"community.general.redis_data_info:", | |
"community.general.redis_info:", | |
"community.general.rhevm:", | |
"community.general.rhn_channel:", | |
"community.general.rhn_register:", | |
"community.general.rhsm_release:", | |
"community.general.rhsm_repository:", | |
"community.general.riak:", | |
"community.general.rocketchat:", | |
"community.general.rollbar_deployment:", | |
"community.general.rpm_ostree_pkg:", | |
"community.general.rundeck_acl_policy:", | |
"community.general.rundeck_job_executions_info:", | |
"community.general.rundeck_job_run:", | |
"community.general.rundeck_project:", | |
"community.general.runit:", | |
"community.general.sap_task_list_execute:", | |
"community.general.sapcar_extract:", | |
"community.general.say:", | |
"community.general.scaleway_compute:", | |
"community.general.scaleway_database_backup:", | |
"community.general.scaleway_image_info:", | |
"community.general.scaleway_ip:", | |
"community.general.scaleway_ip_info:", | |
"community.general.scaleway_lb:", | |
"community.general.scaleway_organization_info:", | |
"community.general.scaleway_private_network:", | |
"community.general.scaleway_security_group:", | |
"community.general.scaleway_security_group_info:", | |
"community.general.scaleway_security_group_rule:", | |
"community.general.scaleway_server_info:", | |
"community.general.scaleway_snapshot_info:", | |
"community.general.scaleway_sshkey:", | |
"community.general.scaleway_user_data:", | |
"community.general.scaleway_volume:", | |
"community.general.scaleway_volume_info:", | |
"community.general.sefcontext:", | |
"community.general.selinux_permissive:", | |
"community.general.selogin:", | |
"community.general.sendgrid:", | |
"community.general.sensu_check:", | |
"community.general.sensu_client:", | |
"community.general.sensu_handler:", | |
"community.general.sensu_silence:", | |
"community.general.sensu_subscription:", | |
"community.general.seport:", | |
"community.general.serverless:", | |
"community.general.shutdown:", | |
"community.general.sl_vm:", | |
"community.general.slack:", | |
"community.general.slackpkg:", | |
"community.general.smartos_image_info:", | |
"community.general.snap:", | |
"community.general.snap_alias:", | |
"community.general.snmp_facts:", | |
"community.general.solaris_zone:", | |
"community.general.sorcery:", | |
"community.general.spectrum_device:", | |
"community.general.spectrum_model_attrs:", | |
"community.general.spotinst_aws_elastigroup:", | |
"community.general.ss_3par_cpg:", | |
"community.general.ssh_config:", | |
"community.general.stackdriver:", | |
"community.general.stacki_host:", | |
"community.general.statsd:", | |
"community.general.statusio_maintenance:", | |
"community.general.sudoers:", | |
"community.general.supervisorctl:", | |
"community.general.svc:", | |
"community.general.svr4pkg:", | |
"community.general.swdepot:", | |
"community.general.swupd:", | |
"community.general.syslogger:", | |
"community.general.syspatch:", | |
"community.general.sysrc:", | |
"community.general.sysupgrade:", | |
"community.general.taiga_issue:", | |
"community.general.telegram:", | |
"community.general.terraform:", | |
"community.general.timezone:", | |
"community.general.twilio:", | |
"community.general.typetalk:", | |
"community.general.udm_dns_record:", | |
"community.general.udm_dns_zone:", | |
"community.general.udm_group:", | |
"community.general.udm_share:", | |
"community.general.udm_user:", | |
"community.general.ufw:", | |
"community.general.uptimerobot:", | |
"community.general.urpmi:", | |
"community.general.utm_aaa_group:", | |
"community.general.utm_aaa_group_info:", | |
"community.general.utm_ca_host_key_cert:", | |
"community.general.utm_ca_host_key_cert_info:", | |
"community.general.utm_dns_host:", | |
"community.general.utm_network_interface_address:", | |
"community.general.utm_network_interface_address_info:", | |
"community.general.utm_proxy_auth_profile:", | |
"community.general.utm_proxy_exception:", | |
"community.general.utm_proxy_frontend:", | |
"community.general.utm_proxy_frontend_info:", | |
"community.general.utm_proxy_location:", | |
"community.general.utm_proxy_location_info:", | |
"community.general.vdo:", | |
"community.general.vertica_configuration:", | |
"community.general.vertica_info:", | |
"community.general.vertica_role:", | |
"community.general.vertica_schema:", | |
"community.general.vertica_user:", | |
"community.general.vexata_eg:", | |
"community.general.vexata_volume:", | |
"community.general.vmadm:", | |
"community.general.wakeonlan:", | |
"community.general.webfaction_app:", | |
"community.general.webfaction_db:", | |
"community.general.webfaction_domain:", | |
"community.general.webfaction_mailbox:", | |
"community.general.webfaction_site:", | |
"community.general.xattr:", | |
"community.general.xbps:", | |
"community.general.xcc_redfish_command:", | |
"community.general.xenserver_facts:", | |
"community.general.xenserver_guest:", | |
"community.general.xenserver_guest_info:", | |
"community.general.xenserver_guest_powerstate:", | |
"community.general.xfconf:", | |
"community.general.xfconf_info:", | |
"community.general.xfs_quota:", | |
"community.general.xml:", | |
"community.general.yarn:", | |
"community.general.yum_versionlock:", | |
"community.general.zfs:", | |
"community.general.zfs_delegate_admin:", | |
"community.general.zfs_facts:", | |
"community.general.znode:", | |
"community.general.zpool_facts:", | |
"community.general.zypper:", | |
"community.general.zypper_repository:", | |
"containers.podman.podman_container:", | |
"containers.podman.podman_container_info:", | |
"containers.podman.podman_containers:", | |
"containers.podman.podman_export:", | |
"containers.podman.podman_image:", | |
"containers.podman.podman_image_info:", | |
"containers.podman.podman_import:", | |
"containers.podman.podman_load:", | |
"containers.podman.podman_login:", | |
"containers.podman.podman_login_info:", | |
"containers.podman.podman_logout:", | |
"containers.podman.podman_network:", | |
"containers.podman.podman_network_info:", | |
"containers.podman.podman_play:", | |
"containers.podman.podman_pod:", | |
"containers.podman.podman_pod_info:", | |
"containers.podman.podman_save:", | |
"containers.podman.podman_secret:", | |
"containers.podman.podman_tag:", | |
"containers.podman.podman_volume:", | |
"containers.podman.podman_volume_info:" | |
] | |
def usage(): | |
print(""" | |
Usage: | |
%s <file glob_pattern> | |
""" % (os.path.basename(sys.argv[0]))) | |
def find_replace(directory, glob_pattern, create_backup=False): | |
for path, dirs, files in os.walk(os.path.abspath(directory)): | |
for filename in fnmatch.filter(files, glob_pattern): | |
pardir = os.path.normpath(os.path.join(path, '..')) | |
pardir = os.path.split(pardir)[-1] | |
filepath = os.path.join(path, filename) | |
print('[%s/%s]' % (filepath,filename)) | |
#backup orig file | |
if create_backup: | |
backup_path = filepath + '.bak' | |
print('DBG: creating backup', backup_path) | |
shutil.copyfile(filepath, backup_path) | |
# print('DBG: replacing in file', filepath) | |
# s = s.replace(search_pattern, replacement) | |
for i in MODULES_LIST: | |
with open(filepath) as f: | |
data = f.read() | |
with open(filepath, "w") as f: | |
data = re.sub("(\s+)" + i.split(".")[2] + "(.*)", r"\1" + i + r"\2", data) | |
f.write(data) | |
def find_nonhandled_modules(directory): | |
for path, dirs, files in os.walk(os.path.abspath(directory)): | |
for filename in fnmatch.filter(files, glob_pattern): | |
filepath = os.path.join(path, filename) | |
with open(filepath) as f: | |
data = f.read() | |
match = re.search(r'- name:.*\n\s+[a-zA-Z_]+:\s*', data) | |
if match: | |
print("Non handled suspected module in [%s/%s]: %s" % (filepath,filename,match.group(0))) | |
if __name__ == '__main__': | |
if (len(sys.argv) != 2): | |
usage() | |
sys.exit(-1) | |
glob_pattern = sys.argv[1] | |
find_replace(".", glob_pattern) | |
find_nonhandled_modules(".") | |
exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment