In section $7.6$ (chapter of Lie Algebra Homology, Cohomology), in Weibel's book An Introduction to Homological Algebra, there is the following definition.
Definition 7.6.1 An extension of Lie algebras (of $\mathfrak{g}$ by $M$) is a short exact sequence of Lie Algebras
$$0 \to M \to \mathfrak{e} \overset{\pi} \to \mathfrak{g} \to 0,$$ in which $M$ is an abelian Lie Algebra.
Now, on next page he quotes the Classification Theorem, where he proves that the aforementioned extensions are classified by the $2$-cocycles of the cohomology $H^{2}_{Lie}( \mathfrak{g},M)$. As far as I know though, the latter group classifies the central extensions of a Lie algebra $\mathfrak{g}$ by $M$ (in which classification I think someone demands $M$ being an abelian Lie algebra as well), an assumption that doesn't seem to get into the account due to Weibel. My question is: Is there a kind of subtlety that I don't understand into the above defintion that implies centrality, or the classification works into a non-central context as well?
If $M$ is abelian but not necessarily central, $\mathfrak{g}$ acts on $M$, and this action should be fixed and cohomology should be understood as being with nontrivial coefficients in this action. The same thing happens for group extensions. The action is trivial iff $M$ is central.