Here's Augustine on the subject. He's describing the legalistic obedience of some of the Israelites under the old covenant.
"...[they] received the law. They did not observe what is in the decalogue. And any who did comply did so out of fear of punishment, not out of love of justice. They were carrying the harp, but they weren't singing. If you are singing, it's enjoyable; if you are fearing, it's burdensome. That's why the old man either doesn't do it [obey] or does it out of fear, not out of love of holiness, not out of delight in chastity, not out of the calmness of charity, but out of fear. It's because he is the old man, and the old man can sing the old song but not the new one. In order to sing the new song he must become the new man.... If you do it [obey] out of love, you are singing the new song. If you do it out of fear but do it all the same you are indeed carrying the harp but you are not yet singing.... Anyone who is still singing the old song has not yet come to an agreement with his adversary [God and his Word]. He is afraid of God coming and condemning him. Chastity has no delights for him yet, justice has no delights for him yet, but it is because he is in dread of God's judgment that he abstains from such deeds. He does not condemn that actual lust that is seething inside him. He does not yet take delight in what is good. He does not yet find there the pleasant inspiration to sing the new song, but out of his old habits he is still fearing punishments. (From "Sermon 9" in Essential Sermons, trans. Edmund Hill, 32-33).
What struck me in this passage is its similarity to the argumentation in the Reformed tradition used by those who assert that love for God is the only proper motivation for obedience. Even the use of the image of singing a new song to represent obedience out of love for God is used by Jack Miller in some of his "sonship" teaching. And the argument that obedience out of fear is actually a form of disobedience (because the person does not yet delight in the law nor hate his sin) is common too.