Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse the get-state output into a hierarchical dictionary and then process #99

Closed
shtripat opened this issue Jan 4, 2017 · 0 comments
Closed
Assignees

Comments

@shtripat
Copy link
Member

shtripat commented Jan 4, 2017

Currently the output of gluster get-state command is read from a file. This file is in ini format and we just read that into json. Each section in the file becomes one dictionary with entries as keys in dictionary. It would be better parseable/processable if we create a proper hierarchical dictionary as below out of this data and then update the detail into central store

{
  'Global': {
    'MYUUID': '3780fd01-8047-402c-81df-e361a1935bb8',
    'op-version': '30900'
  },
  'Peers': [
   .....
  ],
  'Volumes': [
    {
      'name': 'vol1',
      'id': 'ff0bceae-9901-46b0-9464-7fa4836d2535',
      ............
      'Bricks': [
        'Brick1': {
          'hostname': '<FQDN>',
          'path': '<FQDN>:<mounth path>',
          ..........
        },
        ..........
      ],
      'Options': {
        'option1': 'val1',
        'option2': 'val2',
        .........
      },
      ...............
    },
    ........
  ],  
  'Services': [
    {
      'name': 'glustershd',
      'online_status': "Offline",
    },
    ...............
  ],
  'Misc': {
    'Base Port': 49152,
    'Last allocated port': 49153
  }
]
}

This would make looping through the details and updation in central store more predictable and errors can be handled more effectively (as in case a KeyError for one volume doesnt cause other volume details updation failures and the error could be logged for that specific volume only)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants