A configuration information updating method and device, computer device, and storage medium
By obtaining the association between configuration item templates and code repositories, generating syntax tree files, and using multi-threading to update configuration information, the problem of program errors caused by erroneous replacement during configuration item migration is solved, and highly accurate configuration information updates are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-23
- Publication Date
- 2026-03-24
AI Technical Summary
During the migration and update of configuration items in applications or application platforms, existing technologies that directly replace code can easily lead to the accidental replacement of variables and configuration items, posing a risk of program errors.
By obtaining the association between the configuration item template and the code repository, syntax analysis is performed to generate a syntax tree file, the configuration items to be updated are determined, and multi-threading is used to synchronously update the configuration information to ensure that only the configuration items are updated without affecting variables and constants.
It improves the accuracy of configuration information updates, reduces the risk of program errors, and enables more accurate configuration information migration.
Smart Images

Figure CN115357269B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of information technology, and more specifically, to a method, apparatus, computer device, and storage medium for updating configuration information. Background Technology
[0002] With the development of internet technology, various applications and application platforms have emerged. As technology updates, the framework structure and configuration items of these applications and platforms may change.
[0003] In the actual process of migrating and updating configuration items for applications or application platforms, direct code replacement is often used. However, this method will replace all identical code. For example, if the configuration item to be updated is 'a', there may be multiple 'a's in the repository code, some of which may be configuration items and others may be variables. If the code is directly replaced, both the variable and the configuration item 'a' will be replaced. The extra replacement of the variable 'a' is an unexpected behavior and can easily lead to program errors. Summary of the Invention
[0004] This disclosure provides at least one method, apparatus, computer device, and storage medium for updating configuration information.
[0005] In a first aspect, embodiments of this disclosure provide a configuration information update method, including:
[0006] In response to a configuration information modification request, the association between the first configuration item to be modified and the corresponding modified second configuration item in the established configuration item template is obtained, and the original configuration files of each code repository associated with the configuration item template are obtained.
[0007] The original configuration file is subjected to syntax analysis to generate a syntax tree file;
[0008] Identify the configuration item to be updated in the syntax tree file that contains the first configuration information of the first configuration item;
[0009] Based on the second configuration information of the second configuration item, the first configuration information of the configuration item to be updated in each of the code repositories is updated.
[0010] In one optional implementation, obtaining the original configuration files of each code repository associated with the configuration item template includes:
[0011] Obtain the addresses of each code repository associated with the configuration item template;
[0012] Based on the code repository address, the original configuration file is read from the code repository corresponding to the code repository address.
[0013] In one optional implementation, determining the configuration item to be updated in the syntax tree file that contains the first configuration information of the first configuration item includes:
[0014] From each data node in the syntax tree file, find the first data node whose parameter information is the same as that of the first configuration information;
[0015] From the first data nodes found, select the second data nodes whose corresponding node type is configuration item, and use the configuration item corresponding to the second data node as the configuration item to be updated.
[0016] In one optional implementation, updating the first configuration information of the configuration item to be updated in each of the code repositories based on the second configuration information of the second configuration item includes:
[0017] Based on the second configuration information of the second configuration item, multiple threads are used to synchronously update the first configuration information of multiple configuration items to be updated corresponding to the original configuration file, thereby obtaining multiple updated configuration files; wherein each updated configuration file contains the updated configuration items after being updated by the corresponding thread;
[0018] The updated configuration file is synchronized to the code repository.
[0019] In one optional implementation, synchronizing the updated configuration file to the code repository includes:
[0020] The updated configuration files obtained by the multiple threads are merged with the updated configuration items to obtain a merged configuration file;
[0021] In response to the successful verification of the merged configuration file, the original configuration file stored in the code repository is updated using the merged configuration file.
[0022] In one optional implementation, updating the original configuration file stored in the code repository using the merged configuration file includes:
[0023] Identify the updated configuration information of each updated configuration item in the merged configuration file;
[0024] The original configuration file stored in the code repository is updated using the updated configuration information of the updated configuration items.
[0025] In one optional implementation, the association between the first configuration item to be modified and the corresponding second configuration item after modification in the configuration item template is established through the following steps:
[0026] Obtain the first reference path of the first configuration item and the second reference path of the second configuration item;
[0027] Associating the first reference path with the second reference path yields the association relationship between the first reference path and the second reference path, and this association relationship is used as the association relationship between the first configuration item and the second configuration item.
[0028] Secondly, embodiments of this disclosure also provide a configuration information updating device, comprising:
[0029] The acquisition module is used to respond to configuration information modification requests, acquire the association relationship between the first configuration item to be modified and the corresponding modified second configuration item in the established configuration item template, and acquire the original configuration files of each code repository associated with the configuration item template.
[0030] The processing module is used to perform syntax analysis on the original configuration file and generate a syntax tree file;
[0031] The determination module is used to determine the configuration item to be updated in the syntax tree file that has the first configuration information of the first configuration item;
[0032] The update module is used to update the first configuration information of the configuration item to be updated in each of the code repositories based on the second configuration information of the second configuration item.
[0033] Thirdly, embodiments of this disclosure also provide a computer device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the steps of the first aspect above, or any possible implementation of the first aspect, are performed.
[0034] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the first aspect or any possible implementation thereof.
[0035] In the configuration information update method provided in this embodiment, the syntax tree file obtained after parsing the original configuration file can directly display various types of items and configuration items with configuration information in the original configuration file. Therefore, the syntax tree file can more easily find the configuration item to be updated with the first configuration information of the first configuration item. Thus, when the first configuration information of the configuration item to be updated is updated using the second configuration information of the second configuration item (i.e., the configuration information obtained after modifying the first configuration information), the update accuracy can be improved, thereby reducing the risk of program errors caused by configuration information updates.
[0036] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0037] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.
[0038] Figure 1 A flowchart of a configuration information update method provided by an embodiment of this disclosure is shown;
[0039] Figure 2 A flowchart of another configuration information update method provided by an embodiment of this disclosure is shown;
[0040] Figure 3 A flowchart of yet another configuration information update method provided by an embodiment of this disclosure is shown;
[0041] Figure 4 A structural diagram of a configuration information updating device provided in an embodiment of this disclosure is shown;
[0042] Figure 5 A schematic diagram of a computer device provided in an embodiment of this disclosure is shown. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.
[0044] In the actual process of migrating and updating configuration items for applications or application platforms, direct code replacement is often used. For example, if we need to update configuration item 'a' in a configuration item template to configuration item 'b', but 'a' in the code repository could be a configuration item, a variable, or a constant. Direct code replacement would replace all code 'a' with code 'b', which can easily lead to program errors.
[0045] Based on this, this disclosure provides a configuration information update method, comprising: responding to a configuration information modification request, obtaining the association relationship between a first configuration item to be modified and a corresponding modified second configuration item in an established configuration item template, and obtaining the original configuration files of each code repository associated with the configuration item template; performing syntax analysis processing on the original configuration files to generate a syntax tree file; determining the configuration items to be updated in the syntax tree file that have the first configuration information of the first configuration item; and updating the first configuration information of the configuration items to be updated in each code repository based on the second configuration information of the second configuration item.
[0046] In the configuration information update method provided in this embodiment, the syntax tree file obtained after parsing the original configuration file can directly display various types of items and configuration items with configuration information in the original configuration file. Therefore, the syntax tree file can more easily find the configuration item to be updated with the first configuration information of the first configuration item. Thus, when the first configuration information of the first configuration item is updated using the second configuration information of the second configuration item corresponding to the first configuration item (i.e., the configuration information obtained after modifying the first configuration information), the update accuracy can be improved, thereby reducing the risk of program errors caused by configuration information updates.
[0047] The deficiencies of the above solutions and the proposed solutions are the result of the inventor's practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed in this disclosure below should be considered as the inventor's contribution to this disclosure.
[0048] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0049] To facilitate understanding of this embodiment, a configuration information update method disclosed in this disclosure will first be described in detail. The execution subject of the configuration information update method provided in this disclosure is generally a computer device with certain computing power.
[0050] The configuration information update method provided in this disclosure can be applied to a target configuration migration tool. The target configuration migration tool can update the configuration information of the configuration items to be updated in the original configuration file in the code repository based on the modified configuration information of the configuration items in the configuration template.
[0051] See Figure 1 The diagram shows a flowchart of a configuration information update method provided in an embodiment of this disclosure. The method includes steps S101 to S104, wherein:
[0052] S101: In response to the configuration information modification request, obtain the association relationship between the first configuration item to be modified and the corresponding modified second configuration item in the established configuration item template, and obtain the original configuration files of each code repository associated with the configuration item template.
[0053] In this embodiment of the disclosure, the configuration information modification request can be used to request the updating of the configuration information of the configuration item to be updated in the original configuration file in the code repository based on the configuration information of the modified configuration item in the configuration template.
[0054] In practice, configuration maintenance personnel can maintain configuration item templates. They can modify the first configuration information of the first configuration item to be modified within the template and establish associations between the first and second configuration items. The configuration item template can include multiple configuration items and their configuration information. Configuration items can be represented in JavaScript Object Notation (JSON) data format, meaning they can be represented as key-value pairs. Here, the configuration information can include the key, i.e., the name of the configuration item.
[0055] In one implementation, configuration item templates can be maintained by multiple configuration maintenance personnel. Each configuration maintenance personnel can modify at least one first configuration item and control the configuration migration tool to replace the original configuration file based on the second configuration information of the second configuration item associated with the at least one first configuration item.
[0056] like Figure 2 In the flowchart of another configuration information update method shown, the first configuration information of the first configuration item in the configuration item template can be modified in advance. In one implementation, the configuration maintenance personnel can modify the first configuration information of the first configuration item to be modified in the configuration item template. The first configuration item can be a configuration item in the configuration item template whose configuration information needs to be modified; the first configuration item can correspond to the first configuration information. The second configuration item can be a configuration item obtained after modifying the first configuration information of the first configuration item; the second configuration item can correspond to the second configuration information. That is, after modifying the first configuration information of the first configuration item to the second configuration information, the corresponding second configuration item can be obtained. The key of the first configuration item and the corresponding modified second configuration item are different, but the value of the first configuration item and the second configuration item can be the same, that is, the first configuration item and the second configuration item can correspond to the same configuration capability.
[0057] In the embodiments disclosed herein, such as Figure 2 As shown, an association can be established between a first configuration item to be modified and its corresponding modified second configuration item. This association can be pre-established by configuration maintenance personnel. The first configuration item to be modified and its corresponding modified second configuration item can be associated through a reference path; that is, the association can be represented by the association between the first reference path of the first configuration item to be modified and the second reference path of the corresponding modified second configuration item. In one embodiment, the association between the first configuration item to be modified and its corresponding modified second configuration item in the configuration item template can be established through the following steps: obtaining the first reference path of the first configuration item and the second reference path of the second configuration item; associating the first reference path and the second reference path to obtain the association between the first reference path and the second reference path; and using the association between the first reference path and the second reference path as the association between the first configuration item and the second configuration item.
[0058] The reference path of a configuration item represents its relationship with other configuration items. For example, if configuration item A is below configuration item B, it means that configuration item B references configuration item A. The first reference path of the first configuration item can be obtained from the original configuration file generated using that first configuration item. The second reference path of the second configuration item can be pre-modified and can be used to replace the first reference path in the original configuration file.
[0059] In this embodiment of the disclosure, the association between the first configuration item to be modified and the corresponding modified second configuration item can be pre-established by the configuration maintenance personnel, and then the target configuration migration worker can obtain the association.
[0060] In this embodiment of the disclosure, the original configuration file may be obtained from each code repository associated with the configuration item template and stored in the target configuration migration tool. In one implementation, during the process of obtaining the original configuration file of each code repository associated with the configuration item template, the address of each code repository associated with the configuration item template may be obtained; then, based on the code repository address, the original configuration file is read from the code repository corresponding to the code repository address.
[0061] The original configuration file mentioned above can be generated for the first configuration item in the configuration item template. The original configuration file contains the first configuration information for the first configuration item and its value.
[0062] The code repository mentioned above can be pre-created for the first configuration item in the configuration item template. It can also generate the code repository address corresponding to the code repository and then associate the code repository address with the configuration item template.
[0063] In the above implementation process, the code repositories corresponding to each code repository address associated with the configuration item template can be matched first. Then, the original configuration files in each code repository are read one by one. Finally, the target configuration migration tool stores the original configuration files read from each code repository on its local machine.
[0064] S102: Perform syntax analysis on the original configuration file to generate a syntax tree file.
[0065] The original configuration file can be written in the target programming language, such as JavaScript. Since the target configuration migration tool cannot identify the configuration items in the original configuration file, it can be parsed to obtain a syntax tree file that can identify the configuration items. In one implementation, an open-source parser (e.g., the Acorn parser) can be used to perform parsing on the original configuration file stored in the target configuration migration tool to obtain a syntax tree file. The syntax tree file can contain data nodes of various node types, specifically constant nodes, variable nodes, and configuration item nodes. In this embodiment, the configuration item node to be updated is found mainly based on the node type of the data node, as detailed in the following steps.
[0066] S103: Determine the configuration item to be updated in the syntax tree file that has the first configuration information of the first configuration item.
[0067] Following on from the previous section, this section primarily focuses on locating configuration item nodes to be updated. In one implementation, for each syntax tree file generated from the original configuration files of each code repository, a first data node with parameter information identical to the first configuration information can be found from the data nodes in that syntax tree file. Then, from the found first data nodes, second data nodes with the corresponding node type of configuration item are selected, and the configuration item corresponding to the second data node is taken as the configuration item to be updated.
[0068] Here, the parameter information of the first configuration information can refer to the parameter information of the Key, and the first data node can refer to the data node with the same parameter information as the Key of the first configuration item. The first data node may be a configuration item, a constant, or a variable. For example, if the Key of the first configuration item is 'a', the first data node found may be a configuration item with the key 'a', a variable with the value 'a', or a constant with the value 'a'. Therefore, it is necessary to further filter the first data nodes based on the node type. The filtered first data nodes are the configuration items to be updated that have the same parameter information as the Key of the first configuration item. In other words, for each syntax tree file generated from the original configuration files of each code repository, the above steps are used to filter out the configuration items to be updated corresponding to the first configuration item from the syntax tree file. The configuration items to be updated have the first configuration information of the first configuration item.
[0069] S104: Based on the second configuration information of the second configuration item, update the first configuration information of the configuration item to be updated in each of the code repositories.
[0070] Based on the aforementioned association between the first and second configuration items, and the configuration item to be updated corresponding to the first configuration item, the second configuration item corresponding to the configuration item to be updated can be determined. Then, based on the second configuration information of the second configuration item, the first configuration information of the corresponding configuration item to be updated can be updated.
[0071] In this embodiment of the disclosure, for each syntax tree file generated from the original configuration files of each code repository, the target configuration migration tool can update the first configuration information of the configuration item to be updated in the syntax tree file based on the second configuration information of the second configuration item. After the update is completed, the updated syntax tree file can be converted into an updated configuration file written in the target programming language. Then, the updated configuration files obtained locally are synchronized to the corresponding code repository, thereby realizing the update of the original configuration files in each code repository.
[0072] For example, we need to update the first configuration item with key 'a' in the configuration item template to the second configuration item with key 'b'. However, in the code repository, the parameter information 'a' could be a configuration item, a variable, or a constant. The configuration information update method provided in this embodiment only updates the key corresponding to the configuration item with parameter information 'a' in the code repository to 'b', while constants and variables with parameter information 'a' are not replaced. This improves the accuracy of configuration information updates and reduces the risk of program errors caused by configuration information updates.
[0073] To improve processing efficiency, in one implementation, multiple threads can be used to synchronously update multiple configuration items to be updated in the same original configuration file.
[0074] In one implementation, based on the second configuration information of the second configuration item, multiple threads can be used to synchronously update the first configuration information of multiple configuration items to be updated corresponding to the original configuration file, resulting in multiple updated configuration files; the updated configuration files are then synchronized to the code repository. Each updated configuration file contains the updated configuration items updated by the corresponding thread.
[0075] By using multiple threads to synchronously update the first configuration information of multiple configuration items to be updated corresponding to the original configuration file, multiple updated syntax tree files can be obtained. These updated syntax tree files can then be converted into updated configuration files written in the target programming language. Finally, the locally obtained updated configuration files are synchronized to the corresponding code repositories, thus achieving the updating of the original configuration files in each code repository.
[0076] In the above embodiments, each updated configuration file is obtained by updating the first configuration information of at least one of the multiple configuration items to be updated. After obtaining multiple updated configuration files, the multiple updated configuration files can be merged locally to obtain a merged configuration file. In one embodiment, the updated configuration files obtained by multiple threads can be merged with the updated configuration items to obtain a merged configuration file.
[0077] Here, the merged configuration file contains all the updated configuration items. In practice, the updated syntax tree files obtained by multiple threads can be converted into updated configuration files written in the target programming language. Then, based on the updated configuration items, the updated configuration files are merged to obtain the merged configuration file.
[0078] In one implementation, when the updated configuration file is obtained from multiple configuration migration tools, a file merge request can be initiated by the configuration maintenance personnel corresponding to each configuration migration tool to merge the updated configuration items from each configuration migration tool, resulting in a merged configuration file. It should be noted that any configuration migration tool can synchronize the obtained updated configuration files to other configuration migration tools, thus allowing any configuration migration tool to obtain all updated configuration files.
[0079] To ensure the feasibility of the merged configuration file, in one implementation, the merged configuration file can be locally verified. In response to the successful verification of the merged configuration file, the original configuration file stored in the code repository is updated using the merged configuration file.
[0080] When updating the original configuration files stored in the code repository using the merged configuration files, only the updated configuration information of the updated configuration items can be updated. In one implementation, the updated configuration information of the updated configuration items in the merged configuration files can be identified based on the configuration information of each configuration item in the original configuration files; then, the updated configuration information of the updated configuration items can be used to update the original configuration files stored in the code repository. That is, non-updated configuration items, such as constants and variables, do not need to be updated.
[0081] like Figure 3In the flowchart of another configuration information update method, the configuration maintenance personnel update the configuration item template. Specifically, they modify the first configuration information of the first configuration item to be modified in the configuration item template to obtain a second configuration item with second configuration information. Then, they associate the first and second configuration items to obtain the association relationship between them. The process of associating the first and second configuration items can be referred to the previous text and will not be repeated here. The obtained association relationship can be synchronized to the management platform. The management platform can distribute the updated configuration item template to the configuration migration tool. The configuration migration tool obtains the above association relationship, the updated configuration item template, and the original configuration files from the management platform and the code repositories associated with the configuration item template. After obtaining the original configuration files, the original configuration files are parsed to generate a syntax tree file. Then, the configuration items to be updated that contain the first configuration information of the first configuration item in the syntax tree file are identified. Here, the process of generating the syntax tree file and the process of identifying the configuration items to be updated can be referred to the previous text and will not be repeated here. Next, based on the second configuration information of the second configuration item, multiple threads can be used to update the first configuration information of the configuration items to be updated, resulting in multiple updated configuration files. Each thread can update a subset of the configuration items to be updated. Upon receiving a file merge request, multiple updated configuration files can be merged to obtain a merged configuration file. The merged configuration file is then validated. If the validation of the merged configuration file is successful, it indicates that the merged configuration file is usable. At this point, the merged configuration file can be used to update the original configuration file in the code repository.
[0082] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0083] Based on the same inventive concept, this disclosure also provides a configuration information updating device corresponding to the configuration information updating method. Since the principle of the device in this disclosure for solving the problem is similar to the configuration information updating method described above in this disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0084] Reference Figure 4 The diagram shown is a structural schematic of a configuration information updating device provided in an embodiment of this disclosure. The device includes: an acquisition module 401, a processing module 402, a determination module 403, and an update module 404; wherein,
[0085] The acquisition module 401 is used to respond to the configuration information modification request, acquire the association relationship between the first configuration item to be modified and the corresponding modified second configuration item in the established configuration item template, and acquire the original configuration files of each code repository associated with the configuration item template.
[0086] Processing module 402 is used to perform syntax analysis on the original configuration file and generate a syntax tree file;
[0087] The determination module 403 is used to determine the configuration item to be updated in the syntax tree file that has the first configuration information of the first configuration item;
[0088] The update module 404 is used to update the first configuration information of the configuration item to be updated in each of the code repositories based on the second configuration information of the second configuration item.
[0089] In one optional implementation, the acquisition module 401 is specifically used for:
[0090] Obtain the addresses of each code repository associated with the configuration item template;
[0091] Based on the code repository address, the original configuration file is read from the code repository corresponding to the code repository address.
[0092] In one optional implementation, the determining module 403 is specifically used for:
[0093] From each data node in the syntax tree file, find the first data node whose parameter information is the same as that of the first configuration information;
[0094] From the first data nodes found, select the second data nodes whose corresponding node type is configuration item, and use the configuration item corresponding to the second data node as the configuration item to be updated.
[0095] In one optional implementation, the update module 404 is specifically used for:
[0096] Based on the second configuration information of the second configuration item, multiple threads are used to synchronously update the first configuration information of multiple configuration items to be updated corresponding to the original configuration file, thereby obtaining multiple updated configuration files; wherein each updated configuration file contains the updated configuration items after being updated by the corresponding thread;
[0097] The updated configuration file is synchronized to the code repository.
[0098] In one optional implementation, the update module 404 is specifically used for:
[0099] The updated configuration files obtained by the multiple threads are merged with the updated configuration items to obtain a merged configuration file;
[0100] In response to the successful verification of the merged configuration file, the original configuration file stored in the code repository is updated using the merged configuration file.
[0101] In one optional implementation, the update module 404 is specifically used for:
[0102] Identify the updated configuration information of each updated configuration item in the merged configuration file;
[0103] The original configuration file stored in the code repository is updated using the updated configuration information of the updated configuration items.
[0104] In one optional implementation, the acquisition module 401 is specifically used for:
[0105] Obtain the first reference path of the first configuration item and the second reference path of the second configuration item;
[0106] Associating the first reference path with the second reference path yields the association relationship between the first reference path and the second reference path, and this association relationship is used as the association relationship between the first configuration item and the second configuration item.
[0107] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.
[0108] Based on the same technical concept, this disclosure also provides a computer device. (See also...) Figure 5 The diagram shows the structure of a computer device 500 provided in this embodiment of the present disclosure, including a processor 501, a memory 502, and a bus 503. The memory 502 stores execution instructions and includes main memory 5021 and external memory 5022. The main memory 5021, also called internal memory, is used to temporarily store computational data in the processor 501 and data exchanged with external memory 5022 such as a hard disk. The processor 501 exchanges data with the external memory 5022 through the main memory 5021. When the computer device 500 is running, the processor 501 and the memory 502 communicate through the bus 503, causing the processor 501 to execute the following instructions:
[0109] In response to a configuration information modification request, the association between the first configuration item to be modified and the corresponding modified second configuration item in the established configuration item template is obtained, and the original configuration files of each code repository associated with the configuration item template are obtained.
[0110] The original configuration file is subjected to syntax analysis to generate a syntax tree file;
[0111] Identify the configuration item to be updated in the syntax tree file that contains the first configuration information of the first configuration item;
[0112] Based on the second configuration information of the second configuration item, the first configuration information of the configuration item to be updated in each of the code repositories is updated.
[0113] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the configuration information update method described in the above method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0114] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of the configuration information update method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.
[0115] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0116] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0117] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0118] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0119] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0120] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.
Claims
1. A method for updating configuration information, characterized in that, include: In response to a configuration information modification request, the association between the first configuration item to be modified and the corresponding modified second configuration item in the established configuration item template is obtained, and the original configuration files of each code repository associated with the configuration item template are obtained, wherein the original configuration files are generated for the first configuration item in the configuration item template, and the code repository is pre-created for the first configuration item in the configuration item template; The original configuration file is subjected to syntax analysis to generate a syntax tree file; Identify the configuration item to be updated in the syntax tree file that contains the first configuration information of the first configuration item; Based on the second configuration information of the second configuration item, the first configuration information of the configuration item to be updated in each of the code repositories is updated.
2. The method according to claim 1, characterized in that, The step of obtaining the original configuration files of each code repository associated with the configuration item template includes: Obtain the addresses of each code repository associated with the configuration item template; Based on the code repository address, the original configuration file is read from the code repository corresponding to the code repository address.
3. The method according to claim 1, characterized in that, The step of determining the configuration item to be updated in the syntax tree file that contains the first configuration item's first configuration information includes: From each data node in the syntax tree file, find the first data node whose parameter information is the same as that of the first configuration information; From the first data nodes found, select the second data nodes whose corresponding node type is configuration item, and use the configuration item corresponding to the second data node as the configuration item to be updated.
4. The method according to claim 1, characterized in that, The step of updating the first configuration information of the configuration item to be updated in each of the code repositories based on the second configuration information of the second configuration item includes: Based on the second configuration information of the second configuration item, multiple threads are used to synchronously update the first configuration information of multiple configuration items to be updated corresponding to the original configuration file, thereby obtaining multiple updated configuration files; wherein each updated configuration file contains the updated configuration items after being updated by the corresponding thread; The updated configuration file is synchronized to the code repository.
5. The method according to claim 4, characterized in that, The step of synchronizing the updated configuration file to the code repository includes: The updated configuration files obtained by the multiple threads are merged with the updated configuration items to obtain a merged configuration file; In response to the successful verification of the merged configuration file, the original configuration file stored in the code repository is updated using the merged configuration file.
6. The method according to claim 5, characterized in that, The step of updating the original configuration file stored in the code repository using the merged configuration file includes: Identify the updated configuration information of each updated configuration item in the merged configuration file; The original configuration file stored in the code repository is updated using the updated configuration information of the updated configuration items.
7. The method according to claim 1, characterized in that, The association between the first configuration item to be modified and its corresponding second configuration item in the configuration item template is established through the following steps: Obtain the first reference path of the first configuration item and the second reference path of the second configuration item; Associating the first reference path with the second reference path yields the association relationship between the first reference path and the second reference path, and this association relationship is used as the association relationship between the first configuration item and the second configuration item.
8. A configuration information updating device, characterized in that, include: The acquisition module is used to respond to the configuration information modification request, acquire the association relationship between the first configuration item to be modified and the corresponding modified second configuration item in the established configuration item template, and acquire the original configuration files of each code repository associated with the configuration item template, wherein the original configuration files are generated for the first configuration item in the configuration item template, and the code repository is pre-created for the first configuration item in the configuration item template; The processing module is used to perform syntax analysis on the original configuration file and generate a syntax tree file; The determination module is used to determine the configuration item to be updated in the syntax tree file that has the first configuration information of the first configuration item; The update module is used to update the first configuration information of the configuration item to be updated in each of the code repositories based on the second configuration information of the second configuration item.
9. A computer device, characterized in that, include: The computer device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the configuration information update method as described in any one of claims 1 to 7 are performed.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the configuration information update method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and system for updating configuration files in batches
CN111813436A
File modification method and device, server, intelligent terminal and storage medium
CN111813682A
Drive configuration management method, device, medium, equipment and system
CN114116022A