parameters: (self)
return_statement: return get_ca_root_password, ssl_password, ca_root_file_path, ca_root_key_path, \
              ca_config_path, agent_cert_path, agent_key_path
docstring: Generate server ca certificates.
docstring_summary: Generate server ca certificates.
docstring_tokens: Generate server ca certificates .
function: def prepare_ca_certificates(self):
          """
          Generate server ca certificates.
          """
          ca_root_file_path, ca_root_key_path, server_cert_path, server_key_path, agent_cert_path, \
              agent_key_path = self.read_ca_cert_path()
          self.ca_info = self.param_dict.pop(Constant.CA_INFO)
          if not self.ca_info:
              raise Exception(Errors.PARAMETER['gauss_0201'] % 'ca root cert information')
          get_ca_root_cert_path = self.ca_info.get(Constant.CA_CERT_PATH)
          get_ca_root_key_path = self.ca_info.get(Constant.CA_KEY_PATH)
          get_ca_root_password = self.ca_info.get(Constant.CA_PASSWORD)
          if not all([get_ca_root_cert_path, get_ca_root_key_path, get_ca_root_password]):
              raise Exception(Errors.PARAMETER['gauss_0201'] % 'items info of ca root cert')
  
          # copy ca root cert and key files to path of configured
          g.logger.info('Start deploy ca root files.')
          CommonTools.remove_files([ca_root_file_path, ca_root_key_path])
          CommonTools.mkdir_with_mode(os.path.dirname(ca_root_file_path),
                                      Constant.AUTH_COMMON_DIR_STR)
          CommonTools.copy_file_to_dest_path(get_ca_root_cert_path, ca_root_file_path)
          CommonTools.mkdir_with_mode(os.path.dirname(ca_root_key_path),
                                      Constant.AUTH_COMMON_DIR_STR)
          CommonTools.copy_file_to_dest_path(get_ca_root_key_path, ca_root_key_path)
  
          # get ssl password
          ssl_password = CertGenerator.get_rand_str()
          ca_config_path = os.path.join(os.path.dirname(
              os.path.realpath(__file__)), Constant.CA_CONFIG)
          server_ip = CommonTools.get_local_ip(ignore=True)
          g.logger.info('Get server ip:[%s].' % server_ip)
  
          # create server cert
          CertGenerator.create_ca_certificate_with_script(get_ca_root_password, ssl_password,
                                                          ca_root_file_path, ca_root_key_path,
                                                          ca_config_path, server_cert_path,
                                                          server_key_path, server_ip,
                                                          crt_type='server')
          g.logger.info('Successfully generate server ca certificate.')
          return get_ca_root_password, ssl_password, ca_root_file_path, ca_root_key_path, \
              ca_config_path, agent_cert_path, agent_key_path
function_tokens: def prepare_ca_certificates ( self ) : ca_root_file_path , ca_root_key_path , server_cert_path , server_key_path , agent_cert_path , agent_key_path = self . read_ca_cert_path ( ) self . ca_info = self . param_dict . pop ( Constant . CA_INFO ) if not self . ca_info : raise Exception ( Errors . PARAMETER [ 'gauss_0201' ] % 'ca root cert information' ) get_ca_root_cert_path = self . ca_info . get ( Constant . CA_CERT_PATH ) get_ca_root_key_path = self . ca_info . get ( Constant . CA_KEY_PATH ) get_ca_root_password = self . ca_info . get ( Constant . CA_PASSWORD ) if not all ( [ get_ca_root_cert_path , get_ca_root_key_path , get_ca_root_password ] ) : raise Exception ( Errors . PARAMETER [ 'gauss_0201' ] % 'items info of ca root cert' ) # copy ca root cert and key files to path of configured g . logger . info ( 'Start deploy ca root files.' ) CommonTools . remove_files ( [ ca_root_file_path , ca_root_key_path ] ) CommonTools . mkdir_with_mode ( os . path . dirname ( ca_root_file_path ) , Constant . AUTH_COMMON_DIR_STR ) CommonTools . copy_file_to_dest_path ( get_ca_root_cert_path , ca_root_file_path ) CommonTools . mkdir_with_mode ( os . path . dirname ( ca_root_key_path ) , Constant . AUTH_COMMON_DIR_STR ) CommonTools . copy_file_to_dest_path ( get_ca_root_key_path , ca_root_key_path ) # get ssl password ssl_password = CertGenerator . get_rand_str ( ) ca_config_path = os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , Constant . CA_CONFIG ) server_ip = CommonTools . get_local_ip ( ignore = True ) g . logger . info ( 'Get server ip:[%s].' % server_ip ) # create server cert CertGenerator . create_ca_certificate_with_script ( get_ca_root_password , ssl_password , ca_root_file_path , ca_root_key_path , ca_config_path , server_cert_path , server_key_path , server_ip , crt_type = 'server' ) g . logger . info ( 'Successfully generate server ca certificate.' ) return get_ca_root_password , ssl_password , ca_root_file_path , ca_root_key_path , ca_config_path , agent_cert_path , agent_key_path