Added files: RedHat/Integration/ServiceNow/CMDB.class/__class__.yaml RedHat/Integration/ServiceNow/CMDB.class/__methods__/create.rb RedHat/Integration/ServiceNow/CMDB.class/__methods__/create.yaml RedHat/Integration/ServiceNow/CMDB.class/__methods__/delete.rb RedHat/Integration/ServiceNow/CMDB.class/__methods__/delete.yaml RedHat/Integration/ServiceNow/CMDB.class/__methods__/get.rb RedHat/Integration/ServiceNow/CMDB.class/__methods__/get.yaml RedHat/Integration/ServiceNow/CMDB.class/__methods__/get_all.rb RedHat/Integration/ServiceNow/CMDB.class/__methods__/get_all.yaml RedHat/Integration/ServiceNow/CMDB.class/__methods__/update.rb RedHat/Integration/ServiceNow/CMDB.class/__methods__/update.yaml RedHat/Integration/ServiceNow/CMDB.class/__methods__/update_patch.rb RedHat/Integration/ServiceNow/CMDB.class/__methods__/update_patch.yaml RedHat/Integration/ServiceNow/CMDB.class/create.yaml RedHat/Integration/ServiceNow/CMDB.class/delete.yaml RedHat/Integration/ServiceNow/CMDB.class/get.yaml RedHat/Integration/ServiceNow/CMDB.class/get_all.yaml RedHat/Integration/ServiceNow/CMDB.class/update.yaml RedHat/Integration/ServiceNow/CMDB.class/update_patch.yaml RedHat/Integration/ServiceNow/__namespace__.yaml
Do we have any CMDB we could try this out against?
Classes are present RedHat/Integration/ServiceNow/CMDB Referring to this doc : http://docbuilder.usersys.redhat.com/23064/#Provision_VM_from_Template 1) Copied Integration CMDB (create method )to Default domain. 2) Edited default - infrastructure - Provisioning - statemachine - VMProvision_template and gave value for Activate CMDB = /Integration/ServiceNow/CMDB/create 3) provisioned VM 4) checked automation logs ============================Error========== tructure/VM/Provisioning/StateMachines] [----] I, [2015-07-01T16:10:53.003427 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) Invoking [inline] method [Default/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status] with inputs [{"status"=>"Registered DHCP"}] [----] I, [2015-07-01T16:10:53.006272 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) <AEMethod [Default/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status]> Starting [----] I, [2015-07-01T16:10:53.611927 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) <AEMethod [Default/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status]> Ending [----] I, [2015-07-01T16:10:53.612154 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) Method exited with rc=MIQ_OK [----] I, [2015-07-01T16:10:53.613627 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) In State=[ActivateCMDB], invoking [on_entry] method=[update_provision_status(status => 'Activating CMDB')] [----] I, [2015-07-01T16:10:53.616005 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) Updated namespace [Infrastructure/VM/Provisioning/StateMachines/VMProvision_vm/update_provision_status Default/Infrastructure/VM/Provisioning/StateMachines] [----] I, [2015-07-01T16:10:53.616648 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) Invoking [inline] method [Default/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status] with inputs [{"status"=>"Activating CMDB"}] [----] I, [2015-07-01T16:10:53.617461 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) <AEMethod [Default/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status]> Starting [----] I, [2015-07-01T16:10:54.233610 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) <AEMethod [Default/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status]> Ending [----] I, [2015-07-01T16:10:54.233822 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) Method exited with rc=MIQ_OK [----] I, [2015-07-01T16:10:54.234723 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) Processing State=[ActivateCMDB] [----] I, [2015-07-01T16:10:54.235983 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) Following Relationship [miqaedb:/Integration/ServiceNow/CMDB/create#create] [----] I, [2015-07-01T16:10:54.256889 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) Updated namespace [miqaedb:/Integration/ServiceNow/CMDB/create#create Default/Integration/ServiceNow] [----] I, [2015-07-01T16:10:54.286314 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) Updated namespace [Integration/ServiceNow/CMDB/create Default/Integration/ServiceNow] [----] I, [2015-07-01T16:10:54.292763 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) Invoking [inline] method [Default/Integration/ServiceNow/CMDB/create] with inputs [{}] [----] I, [2015-07-01T16:10:54.293650 #26596:de0814] INFO -- : Q-task_id([miq_provision_8]) <AEMethod [Default/Integration/ServiceNow/CMDB/create]> Starting [----] I, [2015-07-01T16:10:54.975989 #28900:f0e808] INFO -- : MiqAeEvent.build_evm_event >> event=<"ems_auth_valid"> inputs=<{:type=>"EmsRedhat"}> [----] I, [2015-07-01T16:10:54.984152 #26596:46f45ec] INFO -- : Q-task_id([miq_provision_8]) <AEMethod create> ----- Create ServiceNow CMDB Record ----- - vmdb_object_type => <miq_provision> [----] I, [2015-07-01T16:10:55.067556 #26596:46f45ec] INFO -- : Q-task_id([miq_provision_8]) <AEMethod create> ----- Create ServiceNow CMDB Record ----- - uri => https:///api/now/table/cmdb_ci_server [----] I, [2015-07-01T16:10:55.068433 #26596:46f45ec] INFO -- : Q-task_id([miq_provision_8]) <AEMethod create> ----- Create ServiceNow CMDB Record ----- - payload => {:virtual=>true, :name=>"cmdb_1", :short_description=>"CloudForms GUID <abdf0742-200b-11e5-85c3-00505696e15b>", :host_name=>[], :cpu_count=>1, :ram=>1024, :vendor=>"VMware"} [----] E, [2015-07-01T16:10:55.109354 #26596:46f45ec] ERROR -- : Q-task_id([miq_provision_8]) <AEMethod create> The following error occurred during method evaluation: [----] E, [2015-07-01T16:10:55.110196 #26596:46f45ec] ERROR -- : Q-task_id([miq_provision_8]) <AEMethod create> NoMethodError: undefined method `+' for nil:NilClass [----] E, [2015-07-01T16:10:55.112083 #26596:46f45ec] ERROR -- : Q-task_id([miq_provision_8]) <AEMethod create> /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:1403:in `addr_port' /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:1340:in `begin_transport' /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:1316:in `transport_request' /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:1294:in `request' /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request' /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:183:in `block in transmit' /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:746:in `start' /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:179:in `transmit' /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:67:in `execute' [----] E, [2015-07-01T16:10:55.128221 #26596:de0814] ERROR -- : Q-task_id([miq_provision_8]) Method STDERR: /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:1403:in `addr_port': undefined method `+' for nil:NilClass (NoMethodError) [----] E, [2015-07-01T16:10:55.128409 #26596:de0814] ERROR -- : Q-task_id([miq_provision_8]) Method STDERR: from /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:1340:in `begin_transport' [----] E, [2015-07-01T16:10:55.128559 #26596:de0814] ERROR -- : Q-task_id([miq_provision_8]) Method STDERR: from /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:1316:in `transport_request' [----] E, [2015-07-01T16:10:55.128703 #26596:de0814] ERROR -- : Q-task_id([miq_provision_8]) Method STDERR: from /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:1294:in `request' [----] E, [2015-07-01T16:10:55.128845 #26596:de0814] ERROR -- : Q-task_id([miq_provision_8]
Shveta, From the logging the uri is not properly formatted: Q-task_id([miq_provision_8]) <AEMethod create> ----- Create ServiceNow CMDB Record ----- - uri => https:///api/now/table/cmdb_ci_server The automate methods shows the uri being built from this code: snow_server = $evm.object['snow_server'] snow_user = $evm.object['snow_user'] snow_password = $evm.object.decrypt('snow_password') table_name = $evm.object['table_name'] uri = "https://#{snow_server}/api/now/table/#{table_name}" table_name is being substituted but "snow_server" is not. Since they are coming from the same object "$evm.object" that would point to a possible configuration error. Please verify that snow_server is being properly set.
Updated the snow_server in the schema . Now the error is : [----] I, [2015-07-06T21:44:38.176257 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) Method exited with rc=MIQ_OK [----] I, [2015-07-06T21:44:38.177518 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) In State=[ActivateCMDB], invoking [on_entry] method=[update_provision_status(status => 'Activating CMDB')] [----] I, [2015-07-06T21:44:38.179593 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) Updated namespace [Infrastructure/VM/Provisioning/StateMachines/VMProvision_vm/update_provision_status Default/Infrastructure/VM/Provisioning/StateMachines] [----] I, [2015-07-06T21:44:38.180162 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) Invoking [inline] method [Default/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status] with inputs [{"status"=>"Activating CMDB"}] [----] I, [2015-07-06T21:44:38.180813 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) <AEMethod [Default/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status]> Starting [----] I, [2015-07-06T21:44:38.593313 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) <AEMethod [Default/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status]> Ending [----] I, [2015-07-06T21:44:38.593481 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) Method exited with rc=MIQ_OK [----] I, [2015-07-06T21:44:38.595449 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) Processing State=[ActivateCMDB] [----] I, [2015-07-06T21:44:38.597964 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) Following Relationship [miqaedb:/Integration/ServiceNow/CMDB/create#create] [----] I, [2015-07-06T21:44:38.616239 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) Updated namespace [miqaedb:/Integration/ServiceNow/CMDB/create#create Default/Integration/ServiceNow] [----] I, [2015-07-06T21:44:38.643423 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) Updated namespace [Integration/ServiceNow/CMDB/create Default/Integration/ServiceNow] [----] I, [2015-07-06T21:44:38.648915 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) Invoking [inline] method [Default/Integration/ServiceNow/CMDB/create] with inputs [{}] [----] I, [2015-07-06T21:44:38.649665 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) <AEMethod [Default/Integration/ServiceNow/CMDB/create]> Starting [----] I, [2015-07-06T21:44:39.163847 #2197:ee780c] INFO -- : Instantiating [/System/Process/Event?EmsEvent%3A%3Aems_event=64336&ExtManagementSystem%3A%3Aems=1&Host%3A%3Ahost=3&MiqServer%3A%3Amiq_server=1&VmOrTemplate%3A%3Avm=4037&ems_id=1&event_id=64336&event_type=VmResourceReallocatedEvent&host_id=3&object_name=Event&vm_id=4037&vmdb_object_type=ems_event] [----] I, [2015-07-06T21:44:39.174374 #2197:ee780c] INFO -- : Updated namespace [/System/Process/Event?EmsEvent%3A%3Aems_event=64336&ExtManagementSystem%3A%3Aems=1&Host%3A%3Ahost=3&MiqServer%3A%3Amiq_server=1&VmOrTemplate%3A%3Avm=4037&ems_id=1&event_id=64336&event_type=VmResourceReallocatedEvent&host_id=3&object_name=Event&vm_id=4037&vmdb_object_type=ems_event Default/System] [----] I, [2015-07-06T21:44:39.219200 #2201:488dd7c] INFO -- : Q-task_id([miq_provision_27]) <AEMethod create> ----- Create ServiceNow CMDB Record ----- - vmdb_object_type => <miq_provision> [----] I, [2015-07-06T21:44:39.250438 #2197:ee780c] INFO -- : Following Relationship [miqaedb:/System/Event/VmResourceReallocatedEvent#create] [----] I, [2015-07-06T21:44:39.261447 #2197:ee780c] INFO -- : Updated namespace [miqaedb:/System/Event/VmResourceReallocatedEvent#create Default/System] [----] I, [2015-07-06T21:44:39.261863 #2197:ee780c] INFO -- : Instance [/Default/System/Event/VmResourceReallocatedEvent] not found in MiqAeDatastore - trying [.missing] [----] I, [2015-07-06T21:44:39.269895 #2197:ee780c] INFO -- : Followed Relationship [miqaedb:/System/Event/VmResourceReallocatedEvent#create] [----] I, [2015-07-06T21:44:39.283421 #2201:488dd7c] INFO -- : Q-task_id([miq_provision_27]) <AEMethod create> ----- Create ServiceNow CMDB Record ----- - uri => https://10.8.59.158/api/now/table/cmdb_ci_server [----] I, [2015-07-06T21:44:39.284085 #2201:488dd7c] INFO -- : Q-task_id([miq_provision_27]) <AEMethod create> ----- Create ServiceNow CMDB Record ----- - payload => {:virtual=>true, :name=>"cmdb_vm", :short_description=>"CloudForms GUID <18d0aeee-2428-11e5-a210-00505696e15b>", :host_name=>[], :cpu_count=>1, :ram=>1024, :vendor=>"VMware"} [----] E, [2015-07-06T21:44:49.050245 #2201:488dd7c] ERROR -- : Q-task_id([miq_provision_27]) <AEMethod create> The following error occurred during method evaluation: [----] E, [2015-07-06T21:44:49.051209 #2201:488dd7c] ERROR -- : Q-task_id([miq_provision_27]) <AEMethod create> RestClient::BadRequest: 400 Bad Request [----] E, [2015-07-06T21:44:49.052393 #2201:488dd7c] ERROR -- : Q-task_id([miq_provision_27]) <AEMethod create> /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!' /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:237:in `process_result' /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:185:in `block in transmit' /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:746:in `start' /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:179:in `transmit' /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:67:in `execute' [----] E, [2015-07-06T21:44:49.066313 #2201:85780c] ERROR -- : Q-task_id([miq_provision_27]) Method STDERR: /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!': 400 Bad Request (RestClient::BadRequest) [----] E, [2015-07-06T21:44:49.066479 #2201:85780c] ERROR -- : Q-task_id([miq_provision_27]) Method STDERR: from /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:237:in `process_result' [----] E, [2015-07-06T21:44:49.066618 #2201:85780c] ERROR -- : Q-task_id([miq_provision_27]) Method STDERR: from /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:185:in `block in transmit' [----] E, [2015-07-06T21:44:49.066777 #2201:85780c] ERROR -- : Q-task_id([miq_provision_27]) Method STDERR: from /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:746:in `start' [----] E, [2015-07-06T21:44:49.066930 #2201:85780c] ERROR -- : Q-task_id([miq_provision_27]) Method STDERR: from /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:179:in `transmit' [----] E, [2015-07-06T21:44:49.067068 #2201:85780c] ERROR -- : Q-task_id([miq_provision_27]) Method STDERR: from /opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:67:in `execute' [----] E, [2015-07-06T21:44:49.067206 #2201:85780c] ERROR -- : Q-task_id([miq_provision_27]) Method STDERR: from <code: rest_result = request.execute>:74:in `<main>' [----] I, [2015-07-06T21:44:49.067875 #2201:85780c] INFO -- : Q-task_id([miq_provision_27]) <AEMethod [Default/Integration/ServiceNow/CMDB/create]> Ending [----] E, [2015-07-06T21:44:49.068566 #2201:85780c] ERROR -- : Q-task_id([miq_provision_27]) Aborting instantiation (unknown method return code) because [Method exited with rc=Unknown RC: [1]] [----] E, [2015-07-06T21:44:49.068913 #2201:85780c] ERROR -- : Q-task_id([miq_provision_27]) State=<ActivateCMDB> running raised exception: <Method exited with rc=Unknown RC: [1]>
Created attachment 1048962 [details] schema
username and password I gave are admin/smartvm. Is that ok ?
Shveta - I tried connecting to the URL in a browser (https://10.8.59.158/api/now/table/cmdb_ci_server) and get the same "bad_request" message. The full response gives a little better understanding of the error: {"error":{"kind":"bad_request","message":"Unsupported Collection now specified","klass":"ApiController::BadRequestError"}} Note, if the credentials are not correct you get a "Authentication failed" method so it looks like your credentials are correct. John - Is there someone, maybe the original author, that can take a look at this ServiceNow issue with the automate methods?
Hi Tina , Can you please take a look at this issue . Last time I verified this bug (https://bugzilla.redhat.com/show_bug.cgi?id=1190260) , I don't remember setting up snow_server .
email update from Nick (ncatling): It sounds like the cmdb_ci_server table may not exist in the the ServiceNow database being used. Verify the table name and amend if necessary - the table name is exposed in the class schema. Regards Nick
(In reply to Greg McCullough from comment #19) > Shveta - I tried connecting to the URL in a browser > (https://10.8.59.158/api/now/table/cmdb_ci_server) and get the same > "bad_request" message. The full response gives a little better > understanding of the error: > > {"error":{"kind":"bad_request","message":"Unsupported Collection now > specified","klass":"ApiController::BadRequestError"}} > > Note, if the credentials are not correct you get a "Authentication failed" > method so it looks like your credentials are correct. > > > John - Is there someone, maybe the original author, that can take a look at > this ServiceNow issue with the automate methods? Hi Shveta, The credentials below are for ServiceNow, rather than CloudForms. Would you confirm they're set correctly please? Thanks. snow_server = $evm.object['snow_server'] snow_user = $evm.object['snow_user'] snow_password = $evm.object.decrypt('snow_password')
Hi , I tried the setup again at the below appliance and got error . https://10.16.7.207 Not sure what snow_server and what snow_server credentials are . https://10.16.7.207/api/now/table/cmdb_ci_server with username/password = admin/smartvm shows " {"error":{"kind":"bad_request","message":"Unsupported Collection now specified","klass":"ApiController::BadRequestError"}}" Please check the appliance . Thanks, Shveta
(In reply to Shveta from comment #25) > Hi , I tried the setup again at the below appliance and got error . > > https://10.16.7.207 > Not sure what snow_server and what snow_server credentials are . > > https://10.16.7.207/api/now/table/cmdb_ci_server with username/password = > admin/smartvm shows " {"error":{"kind":"bad_request","message":"Unsupported > Collection now specified","klass":"ApiController::BadRequestError"}}" > > > Please check the appliance . > > Thanks, > Shveta Please review the documentation - https://access.redhat.com/documentation/en-US/Red_Hat_CloudForms/3.2/html/Integration_with_ServiceNow/chap-Configuring_ServiceNow_Connection.html snow_server - ServiceNow database IP address or resolvable hostname. snow_user - ServiceNow user account with the necessary permissions. snow_password - Associated user account password. The ServiceNow database IP\hostname and credentials are needed, not CloudForms credentials. Do you have access to a ServiceNow database for testing? Thanks.
I don't have access to ServiceNow db . In documentation there are no steps to setup Snow_server .
(In reply to Shveta from comment #27) > I don't have access to ServiceNow db . > In documentation there are no steps to setup Snow_server . The purpose of this ServiceNow integration is to authenticate with an existing ServiceNow database and add\amend items in the ServiceNow database during state machine processing, for example the VM provision state machine. It assumes you have credentials and access to a ServiceNow database instance. ServiceNow itself, is out of the scope of the document. Thanks.
I think some miscommunication started back around comment #12, but I might be able to help clear things up. We (CFME QE) do not have access to a ServiceNow database, and are therefore unable to verify this. Do you have a ServiceNow database you can give us access to, or know someone who does? Better yet, if you have access to a working ServiceNow instance, can you verify this bug on a recent 5.3.z (5.3.4.1+) release using a ServiceNow instance that you have access to? Thanks!
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days