Bug 1498764 - [ceph-iscsi-cli]: If gateway info is not available while exporting to ansible, gwcli should fail gracefully
Summary: [ceph-iscsi-cli]: If gateway info is not available while exporting to ansible...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Ceph Storage
Classification: Red Hat Storage
Component: iSCSI
Version: 3.0
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: z1
: 3.1
Assignee: Paul Cuzner
QA Contact: Tejas
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-05 07:58 UTC by Manohar Murthy
Modified: 2018-11-09 01:00 UTC (History)
5 users (show)

Fixed In Version: ceph-iscsi-cli-2.7-8.el7cp
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-11-09 00:59:17 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github ceph ceph-iscsi-cli pull 122 0 None None None 2018-10-01 16:12:35 UTC
Github ceph ceph-iscsi-cli pull 38 0 None None None 2017-10-10 13:22:45 UTC
Red Hat Product Errata RHBA-2018:3530 0 None None None 2018-11-09 01:00:30 UTC

Description Manohar Murthy 2017-10-05 07:58:36 UTC
Description of problem:
When exporting to ansible mode is tried in gwcli before adding gateways, gwcli exited and shown python errors.
It should have shown proper error message and should have stayed in gwcli prompt only.

Version-Release number of selected component (if applicable):
ceph-iscsi-cli-2.5-8.el7cp.noarch
ceph-iscsi-config-2.3-10.el7cp.noarch


Steps to Reproduce:
1.Have a ceph cluster running and login to iSCSI GW node.
2.Login to gwcli and before adding Gateways, try "export ansible" command.
3.It will throw python errors and exits from gwcli.

Actual results:
1. gwcli throws traceback errors and exits.

/> export ansible
CMD: export mode=ansible
Traceback (most recent call last):
  File "/usr/bin/gwcli", line 187, in <module>
    main()
  File "/usr/bin/gwcli", line 119, in main
    shell.run_interactive()
  File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 905, in run_interactive
    self._cli_loop()
  File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 734, in _cli_loop
    self.run_cmdline(cmdline)
  File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 848, in run_cmdline
    self._execute_command(path, command, pparams, kparams)
  File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 823, in _execute_command
    result = target.execute_command(command, pparams, kparams)
  File "/usr/lib/python2.7/site-packages/configshell_fb/node.py", line 1406, in execute_command
    return method(*pparams, **kparams)
  File "/usr/lib/python2.7/site-packages/gwcli/gateway.py", line 162, in ui_command_export
    self.export_ansible(current_config)
  File "/usr/lib/python2.7/site-packages/gwcli/gateway.py", line 119, in export_ansible
    ansible_vars.append('gateway_ip_list: "{}"'.format(",".join(config['gateways']['ip_list'])))
KeyError: 'ip_list'
[root@avenger ~]# gwcli 
/> export ansible
KeyError: 'ip_list'
[root@avenger ~]# 

Expected results:
1. Should have shown proper error message and continued in gwcli prompt only.

Comment 2 Paul Cuzner 2017-10-10 00:14:23 UTC
patched gateway module in branch BZ1498764 on github. PR raised.

With this commit you see the following when trying to export with an empty config;
[root@rh7-gw1 ~]# gwcli -d
Adding ceph cluster 'ceph' to the UI
Fetching ceph osd information
Querying ceph for state information
Refreshing disk information from the config object
Refreshing gateway & client information
Querying ceph for state information
Gathering pool stats for cluster 'ceph'
/> export mode=bla
CMD: export mode=bla
Invalid export mode requested - supported modes are: ansible,copy
/> export bla
CMD: export mode=bla
Invalid export mode requested - supported modes are: ansible,copy
/> export ansible
CMD: export mode=ansible
Export requested, but the config is empty
/> export copy
CMD: export mode=copy
Export requested, but the config is empty
/> export mode=copy
CMD: export mode=copy
Export requested, but the config is empty
/> export mode=ansible
CMD: export mode=ansible
Export requested, but the config is empty
/>

Comment 5 Jason Dillaman 2018-08-28 12:28:30 UTC
Moving to 3.1.z1 since this is a low-priority issue.

Comment 10 errata-xmlrpc 2018-11-09 00:59:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3530


Note You need to log in before you can comment on or make changes to this bug.