martin f. krafft | cc8851d | 2013-08-27 13:43:16 +0200 | [diff] [blame] | 1 | ================== |
| 2 | reclass to-do list |
| 3 | ================== |
| 4 | |
martin f. krafft | cbaf4c8 | 2013-08-27 13:47:59 +0200 | [diff] [blame] | 5 | Common set of classes |
| 6 | --------------------- |
| 7 | A lot of the classes I have set up during the various stages of development of |
| 8 | |reclass| are generic. It would probably be sensible to make them available as |
| 9 | part of |reclass|, to give people a common baseline to work from, and to |
| 10 | ensure a certain level of consistency between users. |
| 11 | |
martin f. krafft | 2bdfffd | 2014-03-01 13:45:04 +0100 | [diff] [blame] | 12 | This could also provide a more realistic example to users on how to use |
| 13 | |reclass|. |
| 14 | |
martin f. krafft | cc8851d | 2013-08-27 13:43:16 +0200 | [diff] [blame] | 15 | Testing framework |
| 16 | ----------------- |
| 17 | There is rudimentary testing in place, but it's inconsistent. I got |
| 18 | side-tracked into discussions about the philosphy of mocking objects. This |
| 19 | could all be fixed and unified. |
| 20 | |
| 21 | Also, storage, outputters, CLI and adapters have absolutely no tests yet… |
| 22 | |
martin f. krafft | 2bdfffd | 2014-03-01 13:45:04 +0100 | [diff] [blame] | 23 | The testing framework should also incorporate the example classes mentioned |
| 24 | above. |
| 25 | |
martin f. krafft | cc8851d | 2013-08-27 13:43:16 +0200 | [diff] [blame] | 26 | Configurable file extension |
| 27 | --------------------------- |
| 28 | Right now, ``.yml`` is hard-coded. This could be exported to the |
| 29 | configuration file, or even given as a list, so that ``.yml`` and ``.yaml`` |
| 30 | can both be used. |
| 31 | |
martin f. krafft | 2bdfffd | 2014-03-01 13:45:04 +0100 | [diff] [blame] | 32 | Actually, I don't think this is such a good idea. If we create too many |
| 33 | options right now, it'll be harder to unify later. Please also see `issue #17 |
| 34 | <https://github.com/madduck/reclass/issues/17`_ for a discussion about this. |
| 35 | |
martin f. krafft | cc8851d | 2013-08-27 13:43:16 +0200 | [diff] [blame] | 36 | Verbosity, debugging |
| 37 | -------------------- |
| 38 | Verbose output and debug logging would be a very useful addition to help |
| 39 | people understand what's going on, where data are being changed/merged, and to |
| 40 | help solve problems. |
| 41 | |
martin f. krafft | cc8851d | 2013-08-27 13:43:16 +0200 | [diff] [blame] | 42 | Data from CMS for interpolation |
| 43 | ------------------------------- |
| 44 | Depending on the CMS in question, it would be nice if |reclass| had access to |
| 45 | the host-specific data (facts, grains, etc.) and could use those in parameter |
| 46 | interpolation. I can imagine this working for Salt, where the ``grains`` |
| 47 | dictionary (and results from previous external node classifiers) is made |
| 48 | available to the external node classifiers, but I am not convinced this will |
| 49 | be possible in Ansible and Puppet. |
| 50 | |
martin f. krafft | 2bdfffd | 2014-03-01 13:45:04 +0100 | [diff] [blame] | 51 | On the other hand, providing CMS-specific data to reclass will make people |
| 52 | depend on it, meaning Salt cannot be used with multiple tools anymore. |
| 53 | |
| 54 | The way to deal with that would be to map grains, facts, whatever the CMS |
| 55 | calls them, to a shared naming scheme/taxonomy, but that's a painful task, |
| 56 | I think. It would mean, however, that even templates could be shared between |
| 57 | CMSs if they only use the data provided by reclass (i.e. grains/facts become |
| 58 | pillar data). |
martin f. krafft | 3fe5f94 | 2013-08-27 15:58:51 +0200 | [diff] [blame] | 59 | |
martin f. krafft | 4ff1282 | 2013-08-28 11:51:17 +0200 | [diff] [blame] | 60 | Membership information |
| 61 | ---------------------- |
| 62 | It would be nice if |reclass| could provide e.g. the Nagios master node with |
| 63 | a list of clients that define it as their master. That would short-circuit |
| 64 | Puppet's ``storeconfigs`` and Salt's ``mine``. |
| 65 | |
martin f. krafft | 2bdfffd | 2014-03-01 13:45:04 +0100 | [diff] [blame] | 66 | The way I envision this currently is to provide something I call "inventory |
| 67 | queries". For instance, the Nagios master node's reclass data would contain |
| 68 | the following (``$[…]`` would denote interpolation to create a list, a bit |
| 69 | like list comprehension):: |
| 70 | |
| 71 | parameters: |
| 72 | nagios: |
| 73 | hosts: $[nagios:master == SELF.nodename] |
| 74 | |
| 75 | This would cause |reclass| to iterate the inventory and generate a list of all |
| 76 | the nodes that define a parameter ``nagios:master`` whose value equals to the |
| 77 | name of the current node. |
| 78 | |
| 79 | This could be greatly simplified. For instance, we could simply limit |
| 80 | comparisons against the name of the current node and just specify |
| 81 | |
| 82 | :: |
| 83 | |
| 84 | $[nagios:master] |
| 85 | |
| 86 | which would be expanded to a list of node names whose pillar data includes |
| 87 | ``${nagios:master}`` that matches the current node's name. |
| 88 | |
| 89 | Or it could be made arbitrarily complex and flexible, e.g. any of the |
| 90 | following:: |
| 91 | |
| 92 | $[nagios:master == SELF.nodename] # replace with nodename |
| 93 | $[nagios:master == SELF.nodename | nodename] # name replacement value |
| 94 | $[nagios:master == SELF.nodename | nagios:nodeid] # replace with pillar data |
| 95 | $[x:nagios:nodeid foreach x | x:nagios:master == SELF.nodename] |
| 96 | … |
| 97 | |
| 98 | I'd rather not code this up from scratch, so I am looking for ideas for reuse… |
| 99 | |
martin f. krafft | 54bb472 | 2013-12-26 14:47:19 +1300 | [diff] [blame] | 100 | Configuration file lookup improvements |
| 101 | -------------------------------------- |
| 102 | Right now, the adapters and the CLI look for the :doc:`configuration file |
| 103 | <configfile>` in a fixed set of locations. On of those derives from |
| 104 | ``OPT_INVENTORY_BASE_URI``, the default inventory base URI (``/etc/reclass``). |
| 105 | This should probably be updated in case the user changes the URI. |
| 106 | |
| 107 | Furthermore, ``$CWD`` and ``~`` might not make a lot of sense in all |
| 108 | use-cases. |
| 109 | |
martin f. krafft | 2bdfffd | 2014-03-01 13:45:04 +0100 | [diff] [blame] | 110 | However, this might be better addressed by the following point: |
| 111 | |
| 112 | Adapter class hierarchy |
| 113 | ----------------------- |
| 114 | At the moment, adapters are just imperative code. It might make more sense to |
| 115 | wrap them in classes, which customise things like command-line and config file |
| 116 | parsing. |
| 117 | |
| 118 | One nice way would be to generalise configuration file reading, integrate it |
| 119 | with command-line parsing, and then allow the consumers (the adapters) to |
| 120 | configure them, for instance, in the Salt adapter:: |
| 121 | |
| 122 | config_proxy = ConfigProxy() |
| 123 | config_proxy.set_configfile_search_path(['/etc/reclass', '/etc/salt']) |
| 124 | config_proxy.lock_config_option('output', 'yaml') |
| 125 | |
| 126 | The last call would effectively remove the ``--output`` config option from the |
| 127 | CLI, and yield an error (or warning) if the option was encountered while |
| 128 | parsing the configuration file. |
| 129 | |
| 130 | Furthermore, the class instances could become long-lived and keep a reference |
| 131 | to a storage proxy, e.g. to prevent having to reload storage on every request. |
| 132 | |
| 133 | Node lists |
| 134 | ---------- |
| 135 | Class mappings are still experimental, and one of the reasons I am not too |
| 136 | happy with them right now is that one would still need to provide node files |
| 137 | for all nodes for ``inventory`` invocations. This is because class mappings |
| 138 | can assign classes based on patterns or regular expressions, but it is not |
| 139 | possible to turn a pattern or regular expression into a list of valid nodes. |
| 140 | |
| 141 | `Issue #9 <https://github.com/madduck/reclass/issues/9>`_ contains a lengthy |
| 142 | discussion on this. At the moment, I am unsure what the best way forward is. |
| 143 | |
| 144 | Inventory filters |
| 145 | ----------------- |
| 146 | As described in `issue #11 <https://github.com/madduck/reclass/issues/11>`_: |
| 147 | provide a means to limit the enumeration of the inventory, according to node |
| 148 | name patterns, or using classes white-/blacklists. |
| 149 | |
martin f. krafft | 3fe5f94 | 2013-08-27 15:58:51 +0200 | [diff] [blame] | 150 | .. include:: substs.inc |