m2 icon indicating copy to clipboard operation
m2 copied to clipboard

Localise constants

Open sirushtim opened this issue 8 years ago • 2 comments

To ease readability, move all the constants to their respective classes as class attributes. It also makes sure when we remove a module, we remove the constants too or else we risk dead code in the constants.py file.

So for example, iscsi.py will have the following related constants in the file :

ISCSI_UPDATE_SUCCESS = 'successfully' ISCSI_UPDATE_FAILURE = 'already' ISCSI_CREATE_COMMAND = 'create' ISCSI_DELETE_COMMAND = 'delete'

will be moved to

... class ISCSI(object): metaclass = ABCMeta (ISCSI_UPDATE_SUCCESS, ISCSI_UPDATE_FAILURE) = ('successfully', 'already') ...

sirushtim avatar Mar 02 '17 19:03 sirushtim

that particular set of constants should be removed as we are not using it. But the constants will be moved to respective drivers.

chemistry-sourabh avatar Mar 02 '17 19:03 chemistry-sourabh

Yeah, also, I see defaults in the constants file. Ideally, I'd like them to be optional config options if applicable and hopefully we can do away with the entire constants.py file.

sirushtim avatar Mar 02 '17 19:03 sirushtim