Why am I getting uninitialized constant and how can I initialize SCRIPT_CLASS? I get the following error. I'm trying to print Ansible tower job names.

NameError: uninitialized constant MiqAeMethodService::MiqAeServiceManageIQProvidersAnsibleTowerConfigurationManagerConfigurationScript

This is the code I’m trying to include in cloudforms essentials and if it works then I can create a dialog_hash. I’m following this article

SCRIPT_CLASS = 'ManageIQ_Providers_AnsibleTower_ConfigurationManager_ConfigurationScript'.freeze
job_template =  $evm.vmdb(SCRIPT_CLASS)
log(:info, "Job template name is : #{job_template.name}")
log(:info, "Job template name is : #{job_template.id}")

Complete error:

[----] E, [2021-12-14T04:17:52.557495 #304:2b26c405c5d8] ERROR -- automation: <AEMethod list_ec2_template_guids> The following error occurred during method evaluation:
[----] E, [2021-12-14T04:17:52.558158 #304:2b26c405c5d8] ERROR -- automation: <AEMethod list_ec2_template_guids>   NameError: uninitialized constant MiqAeMethodService::MiqAeServiceManageIQProvidersAnsibleTowerConfigurationManagerConfigurationScript
[----] E, [2021-12-14T04:17:52.558975 #304:2b26c405c5d8] ERROR -- automation: <AEMethod list_ec2_template_guids>   (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/bundler/gems/manageiq-automation_engine-5eeb6aaf0106/lib/miq_automation_engine/engine/miq_ae_method_service.rb:5:in `const_missing'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/inflector/methods.rb:284:in `const_get'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/inflector/methods.rb:284:in `block in constantize'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/inflector/methods.rb:280:in `each'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/inflector/methods.rb:280:in `inject'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/inflector/methods.rb:280:in `constantize'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/bundler/gems/manageiq-automation_engine-5eeb6aaf0106/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_legacy.rb:96:in `service_model_lookup'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/bundler/gems/manageiq-automation_engine-5eeb6aaf0106/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_vmdb.rb:9:in `service_model'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/bundler/gems/manageiq-automation_engine-5eeb6aaf0106/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_vmdb.rb:4:in `vmdb'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /usr/share/ruby/drb/drb.rb:1635:in `perform_without_block'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /usr/share/ruby/drb/drb.rb:1595:in `perform'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /usr/share/ruby/drb/drb.rb:1679:in `block (2 levels) in main_loop'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /usr/share/ruby/drb/drb.rb:1675:in `loop'
(drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /usr/share/ruby/drb/drb.rb:1675:in `block in main_loop'
[----] E, [2021-12-14T04:17:52.560797 #304:2b26c402720c] ERROR -- automation: Method STDERR: (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/bundler/gems/manageiq-automation_engine-5eeb6aaf0106/lib/miq_automation_engine/engine/miq_ae_method_service.rb:5:in `const_missing': uninitialized constant MiqAeMethodService::MiqAeServiceManageIQProvidersAnsibleTowerConfigurationManagerConfigurationScript (NameError)
[----] E, [2021-12-14T04:17:52.560952 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/inflector/methods.rb:284:in `const_get'
[----] E, [2021-12-14T04:17:52.561044 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/inflector/methods.rb:284:in `block in constantize'
[----] E, [2021-12-14T04:17:52.561171 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/inflector/methods.rb:280:in `each'
[----] E, [2021-12-14T04:17:52.561308 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/inflector/methods.rb:280:in `inject'
[----] E, [2021-12-14T04:17:52.561884 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/inflector/methods.rb:280:in `constantize'
[----] E, [2021-12-14T04:17:52.562083 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/gems/activesupport-6.0.4/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
[----] E, [2021-12-14T04:17:52.562189 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/bundler/gems/manageiq-automation_engine-5eeb6aaf0106/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_legacy.rb:96:in `service_model_lookup'
[----] E, [2021-12-14T04:17:52.562300 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/bundler/gems/manageiq-automation_engine-5eeb6aaf0106/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_vmdb.rb:9:in `service_model'
[----] E, [2021-12-14T04:17:52.562413 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /opt/manageiq/manageiq-gemset/bundler/gems/manageiq-automation_engine-5eeb6aaf0106/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_vmdb.rb:4:in `vmdb'
[----] E, [2021-12-14T04:17:52.562568 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /usr/share/ruby/drb/drb.rb:1635:in `perform_without_block'
[----] E, [2021-12-14T04:17:52.562701 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /usr/share/ruby/drb/drb.rb:1595:in `perform'
[----] E, [2021-12-14T04:17:52.562820 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /usr/share/ruby/drb/drb.rb:1679:in `block (2 levels) in main_loop'
[----] E, [2021-12-14T04:17:52.562949 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /usr/share/ruby/drb/drb.rb:1675:in `loop'
[----] E, [2021-12-14T04:17:52.563060 #304:2b26c402720c] ERROR -- automation: Method STDERR: from (drbunix:///tmp/automation_engine20211214-304-1ypaiyy) /usr/share/ruby/drb/drb.rb:1675:in `block in main_loop'
[----] E, [2021-12-14T04:17:52.563207 #304:2b26c402720c] ERROR -- automation: Method STDERR: from /CloudForms_Essentials/Integration/Amazon/EC2/DynamicDialogs/list_ec2_template_guids:120:in `<main>'
[----] I, [2021-12-14T04:17:52.566639 #304:2b26bfe53fc4]  INFO -- automation: <AEMethod [/CloudForms_Essentials/Integration/Amazon/EC2/DynamicDialogs/list_ec2_template_guids]> Ending
[----] E, [2021-12-14T04:17:52.567269 #304:2b26bfe53fc4] ERROR -- automation: Aborting instantiation (unknown method return code) because [Method exited with rc=Unknown RC: [1]]
[----] I, [2021-12-14T04:17:52.572561 #304:2b26bfe53fc4]  INFO -- automation: User [admin] with current group ID [2] name [EvmGroup-super_administrator]
[----] I, [2021-12-14T04:17:52.575261 #304:2b26bfe53fc4]  INFO -- automation: Instantiating [/Integration/Amazon/EC2/DynamicDialogs/list_ec2_flavor_ids?MiqServer%3A%3Amiq_server=1&ServiceTemplate%3A%3Aservice_template=6&User%3A%3Auser=1&dialog_number_of_vms=&dialog_src_vm_id=&dialog_vm_name=&object_name=list_ec2_flavor_ids&vmdb_object_type=service_template]
[----] I, [2021-12-14T04:17:52.582587 #304:2b26bfe53fc4]  INFO -- automation: Updated namespace [/Integration/Amazon/EC2/DynamicDialogs/list_ec2_flavor_ids?MiqServer%3A%3Amiq_server=1&ServiceTemplate%3A%3Aservice_template=6&User%3A%3Auser=1&dialog_number_of_vms=&dialog_src_vm_id=&dialog_vm_name=&object_name=list_ec2_flavor_ids&vmdb_object_type=service_template  CloudForms_Essentials/Integration/Amazon/EC2]
[----] I, [2021-12-14T04:17:52.616356 #304:2b26bfe53fc4]  INFO -- automation: Updated namespace [Integration/Amazon/EC2/DynamicDialogs/list_ec2_flavor_ids  CloudForms_Essentials/Integration/Amazon/EC2]
[----] I, [2021-12-14T04:17:52.619578 #304:2b26bfe53fc4]  INFO -- automation: Invoking [inline] method [/CloudForms_Essentials/Integration/Amazon/EC2/DynamicDialogs/list_ec2_flavor_ids] with inputs [{}]
[----] I, [2021-12-14T04:17:52.620793 #304:2b26bfe53fc4]  INFO -- automation: <AEMethod [/CloudForms_Essentials/Integration/Amazon/EC2/DynamicDialogs/list_ec2_flavor_ids]> Starting
[----] I, [2021-12-14T04:17:52.888322 #304:2b26c2b3d300]  INFO -- automation: <AEMethod list_ec2_flavor_ids>     Attribute

The Tower-related object names have changed since the original Automate book was written, this section describes the new names:

Hope this helps,
pemcg