Skip to content

Types redesign #82

@MaxFedotov

Description

@MaxFedotov

Hello @bastelfreak and @mcrauwel!

I am now looking at types design and I think that it wasn't such a good idea to wrap everything in arrays, because right now all configurations files are looking a bit ugly.
Let me show my thoughts using examples.
Right now in order to configure multiples users in hiera we need to write an array of hashes, like:

"proxysql::mysql_users": [
    { "user1": {
        "password": "*92C74DFBDA5D60ABD41EFD7EB0DAE389F4646ABB",
        "default_hostgroup": 1,
        "transaction_persistent": false }
    },
    { "user2": {
        "password": "*86935F2843252CFAAC4CE713C0D5FF80CF444F3B",
        "default_hostgroup": 2 }
    },
    { "user3": {
        "password": "*86935F2843252CFAAC4CE713C0D5FF80CF444F3B",
        "default_hostgroup": 2 }
    },
    { "user4": {
        "password": "*86935F2843252CFAAC4CE713C0D5FF80CF444F3B",
        "default_hostgroup": 2 }
    }
 ]

but actually this arrays brackets just make reading in case of many users harder.
So my proposal is to get rid of arrays and use pure hashes (so it will be more ruby way).
So we will have this configuration parameter like:

"proxysql::mysql_users": {
    "user1": {
        "password": "*92C74DFBDA5D60ABD41EFD7EB0DAE389F4646ABB",
        "default_hostgroup": 1,
        "transaction_persistent": false 
    },
    "user2": {
        "password": "*86935F2843252CFAAC4CE713C0D5FF80CF444F3B",
        "default_hostgroup": 2 
    },
    "user3": {
        "password": "*86935F2843252CFAAC4CE713C0D5FF80CF444F3B",
        "default_hostgroup": 2 
    },
    "user4": {
        "password": "*86935F2843252CFAAC4CE713C0D5FF80CF444F3B",
        "default_hostgroup": 2 
    }
}

And the same thing for other types. As you see, this will be backward incompatible change, but it will make code an configuration more cleaner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions