If you want publishing disabled, I would just stop publishers' service. No need to remove targets and other stuff. You can even push notifications about maintenance. You can check how to achieve this by looking into Atila's Sos last year Tridion Developers Summit lightning talk
Up until Tridion Sites 9.5 you could publish Components in two ways:
Directly, if the Component has a "Dynamic Component Template." This is when you have a Component Template associated with the Schema for the Component and set to publish dynamically.
Indirectly, as part of the rendered content or added binaries of a page or other Component ...
There is no out of the box option for this. It is either all, or some. There is no option to customize the existing GUI window to modify information during selection what needs to be done because the information about in which publications item should be published is done in Resolver after clicking on the button publish.
Now you can always construct your ...
I would use a custom resolver to achieve this. This is a class which is executed after an item has been put in the publish queue, but before it is rendered and transported to the deployer. They are easy to do and very flexible.
The following example might get you started (with the usual 'works on my machine' caveat):
I'm assuming you are altering the Page Package item and not the Output JSON... but in any case, what you are trying to achieve is not possible using templating.
You can however override the Page publish url using a Deployer extension, but why do you want to do that in the first place? I have the feeling that that's asking for trouble, ie. you will be ...
The Publish Transactions you are adding in your event handler are before the original Publish Transaction, because your event handler triggers on the “Initiated” phase. That is: before the original Publish action executes.
If you want to add them after, you should subscribe to the “Processed” phase.
The Stack Trace pretty much tells you where the problem lies:
The error occurs in the PublishConfiguration TBB
It’s trying to publish “Localization Data”
For that purpose, it tries to determine the “Site Localizations” (i.e. related Publications in a BluePrint)
It tries to obtain a “Site ID” from a Publication.
This tries to construct a TOM.NET ItemFields ...
As Marko mentioned, if you want to suspend publishing altogether, you could just stop all Publisher Services.
If you are using Topology Manager, you can also mark individual CD Environments as "offline". This will suspend publishing to those CD Environments only.
Maybe a reason to migrate to Topology Manager based publishing? :-)
maybe first check DB configuration in CD Discovery Service, and test DB is accessible from CD with port number and user account.
also verify the CD Discovery Service endpoint is accessible https://prod-discoverysvc.ccccc.com/discovery.svc. username/password is correct with topology setup. if not please provide test and maybe try other checks.
Looks like the issue is having communication issue from CMS to discovery service. Please register the keystore on CM for discovery service and enable keystore entry on cd_transport_conf.xml
Example : Under sender type: DiscoveryService
Keystore : <Ketstore Path=“jrepath\lib\security\cacerts” Secret=changeit”
Hope this helps .