Section 2. The procedure under section one may be used to secure determinations of right, duty, status or other legal relations under deeds, wills or written contracts or other writings constituting a contract or contracts or under the common law, or a charter, statute, municipal ordinance or by-law, or administrative regulation, including determination of any question of construction or validity thereof which may be involved in such determination. Said procedure under section one may be used in the superior court to enjoin and to obtain a determination of the legality of the administrative practices and procedures of any municipal, county or state agency or official which practices or procedures are alleged to be in violation of the Constitution of the United States or of the constitution or laws of the commonwealth, or are in violation of rules or regulations promulgated under the authority of such laws, which violation has been consistently repeated; provided, however, that this section shall not apply to the governor and council or the legislative and judicial departments. For the purpose of this section practices or procedures mean the customary and usual method of conducting municipal, county, state agency or official business.
The foregoing enumeration shall not limit or restrict the exercise of the general powers conferred in section one in any proceeding where declaratory relief is sought, in which a judgment or decree will terminate the controversy or remove an uncertainty.