'prepare router for instantiation'

def _prepare_router(self):

    if (self.config.config_options['cacert_file']['value'] and self.config.config_options['cert_file']['value'] and self.config.config_options['key_file']['value']):
        router_pem = '/tmp/router.pem'
        with open(router_pem, 'w') as rfd:
            rfd.write(open(self.config.config_options['cert_file']['value']).read())
            rfd.write(open(self.config.config_options['key_file']['value']).read())
            if (self.config.config_options['cacert_file']['value'] and os.path.exists(self.config.config_options['cacert_file']['value'])):
                rfd.write(open(self.config.config_options['cacert_file']['value']).read())
        atexit.register(Utils.cleanup, [router_pem])
        self.config.config_options['default_cert']['value'] = router_pem
    elif (self.config.config_options['default_cert']['value'] is None):
        self.config.config_options['default_cert']['include'] = False
    options = self.config.to_option_list(ascommalist='labels')
    cmd = ['router', self.config.name]
    cmd.extend(options)
    cmd.extend(['--dry-run=True', '-o', 'json'])
    results = self.openshift_cmd(cmd, oadm=True, output=True, output_type='json')
    if ((results['returncode'] != 0) or ('items' not in results['results'])):
        return results
    oc_objects = {'DeploymentConfig': {'obj': None, 'path': None, 'update': False}, 'Secret': {'obj': None, 'path': None, 'update': False}, 'ServiceAccount': {'obj': None, 'path': None, 'update': False}, 'ClusterRoleBinding': {'obj': None, 'path': None, 'update': False}, 'Service': {'obj': None, 'path': None, 'update': False}}
    for res in results['results']['items']:
        if (res['kind'] == 'DeploymentConfig'):
            oc_objects['DeploymentConfig']['obj'] = DeploymentConfig(res)
        elif (res['kind'] == 'Service'):
            oc_objects['Service']['obj'] = Service(res)
        elif (res['kind'] == 'ServiceAccount'):
            oc_objects['ServiceAccount']['obj'] = ServiceAccount(res)
        elif (res['kind'] == 'Secret'):
            oc_objects['Secret']['obj'] = Secret(res)
        elif (res['kind'] == 'ClusterRoleBinding'):
            oc_objects['ClusterRoleBinding']['obj'] = RoleBinding(res)
    if (not oc_objects['DeploymentConfig']['obj']):
        return results
    oc_objects['DeploymentConfig']['obj'] = self.add_modifications(oc_objects['DeploymentConfig']['obj'])
    for (oc_type, oc_data) in oc_objects.items():
        if (oc_data['obj'] is not None):
            oc_data['path'] = Utils.create_tmp_file_from_contents(oc_type, oc_data['obj'].yaml_dict)
    return oc_objects
