diff --git a/.gitignore b/.gitignore index 303e93381..1f5efe983 100644 --- a/.gitignore +++ b/.gitignore @@ -38,8 +38,9 @@ site/ assets/ Splunk_TA_Dynatrace/* Splunk_TA_Dynatrace_ucc/* -demo_addon_for_splunk/ demo_addon_for_splunk_already_exists/ +demo_addon_for_splunk_license/ +addon_name init_addon_for_ucc_package/ # UI build diff --git a/docs/commands.md b/docs/commands.md index 8e2c2c28c..1a7199895 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -74,8 +74,11 @@ It takes the following parameters: * `--addon-display-name` - [required] add-on "official" name. * `--addon-input-name` - [required] name of the generated input. * `--addon-version` - [optional] version of the generated add-on, with `0.0.1` by default. -* `--overwrite` - [optional] overwrites the already existing folder. - By default, you can't generate a new add-on to an already existing folder. +* `--overwrite` - [optional] overwrites the already existing folder. By default, you can't generate a new add-on to an already existing folder. +* `--add-license` - [optional] Adds license agreement such as [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt), [MIT License](https://mit-license.org/), or +[SPLUNK PRE-RELEASE SOFTWARE LICENSE AGREEMENT](https://www.splunk.com/en_us/legal/splunk-pre-release-software-license-agreement.html) in your `package/LICENSES` directory. If not mentioned an empty License.txt will be generated. + +> **Note:** The add-on will not build if the input for `--add-license` is not one of the following: `Apache License 2.0`, `MIT License`, or `SPLUNK PRE-RELEASE SOFTWARE LICENSE AGREEMENT`. If you want to keep another license in your add-on, place it in `package/LICENSES` directory and it will be shipped ## `ucc-gen import-from-aob` diff --git a/splunk_add_on_ucc_framework/commands/init.py b/splunk_add_on_ucc_framework/commands/init.py index acdd4564a..798f77370 100644 --- a/splunk_add_on_ucc_framework/commands/init.py +++ b/splunk_add_on_ucc_framework/commands/init.py @@ -67,6 +67,7 @@ def _generate_addon( addon_version: str, addon_rest_root: str | None = None, overwrite: bool = False, + add_license: str | None = None, ) -> str: generated_addon_path = os.path.join( os.getcwd(), @@ -103,9 +104,21 @@ def _generate_addon( _f.write(global_config_rendered_content) package_path = os.path.join(generated_addon_path, "package") os.makedirs(package_path) - package_license_path = os.path.join(package_path, "LICENSE.txt") - with open(package_license_path, "w") as _f: - pass + package_license_dir = os.path.join(package_path, "LICENSES") + os.makedirs(package_license_dir) + + if add_license: + package_license_path = os.path.join(package_license_dir, f"{add_license}.txt") + template_path = utils.get_license_path(add_license) + with open(template_path) as content: + license_content = content.read() + with open(package_license_path, "w") as _f: + _f.write(license_content) + else: + # add-on licenses are to be kept in package/LICENSES directory only + package_license_path = os.path.join(package_license_dir, "LICENSE.txt") + with open(package_license_path, "w") as _f: + pass package_readme_path = os.path.join(package_path, "README.txt") with open(package_readme_path, "w") as _f: pass @@ -117,6 +130,7 @@ def _generate_addon( addon_name=addon_name, addon_version=addon_version, addon_display_name=addon_display_name, + add_license=add_license, ) ) with open(package_app_manifest_path, "w") as _f: @@ -160,6 +174,7 @@ def init( addon_version: str, addon_rest_root: str | None = None, overwrite: bool = False, + add_license: str | None = None, ) -> str: if not _is_valid_addon_name(addon_name): logger.error( @@ -199,12 +214,12 @@ def init( addon_version, addon_rest_root, overwrite, + add_license, ) logger.info(f"Generated add-on is located here {generated_addon_path}") - logger.info( - "LICENSE.txt and README.txt are empty, " - "you may need to modify the content of those files\n" - ) + if add_license: + logger.info(f"Specified {add_license} has been added to Licenses directory.") + logger.info("README.txt is empty, you may need to modify the content of this file.") logger.info( f"""You have generated your add-on and are wondering what to do next? \ UCC offers many solutions to improve add-ons! diff --git a/splunk_add_on_ucc_framework/main.py b/splunk_add_on_ucc_framework/main.py index 71c86af6e..20e8cf734 100644 --- a/splunk_add_on_ucc_framework/main.py +++ b/splunk_add_on_ucc_framework/main.py @@ -200,6 +200,21 @@ def main(argv: Optional[Sequence[str]] = None) -> int: default=False, help="overwrite already generated add-on folder", ) + init_parser.add_argument( + "--add-license", + type=str, + choices=[ + "Apache License 2.0", + "MIT License", + "SPLUNK PRE-RELEASE SOFTWARE LICENSE AGREEMENT", + ], + help=( + "adds any one of license agreement such as 'Apache License 2.0', 'MIT License', or " + "'SPLUNK PRE-RELEASE SOFTWARE LICENSE AGREEMENT' to the `/package/LICENSES` directory." + ), + required=False, + default=None, + ) import_from_aob_parser = subparsers.add_parser( "import-from-aob", description="[Experimental] Import from AoB" @@ -235,6 +250,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int: addon_input_name=args.addon_input_name, addon_version=args.addon_version, overwrite=args.overwrite, + add_license=args.add_license, ) if args.command == "import-from-aob": import_from_aob.import_from_aob( diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/LICENSES/Apache-2.0.txt b/splunk_add_on_ucc_framework/templates/Licenses/Apache License 2.0.txt similarity index 100% rename from tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/LICENSES/Apache-2.0.txt rename to splunk_add_on_ucc_framework/templates/Licenses/Apache License 2.0.txt diff --git a/splunk_add_on_ucc_framework/templates/Licenses/MIT License.txt b/splunk_add_on_ucc_framework/templates/Licenses/MIT License.txt new file mode 100644 index 000000000..03e8bb5ab --- /dev/null +++ b/splunk_add_on_ucc_framework/templates/Licenses/MIT License.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright [yyyy] [name of copyright owner] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/templates/Licenses/SPLUNK PRE-RELEASE SOFTWARE LICENSE AGREEMENT.txt b/splunk_add_on_ucc_framework/templates/Licenses/SPLUNK PRE-RELEASE SOFTWARE LICENSE AGREEMENT.txt new file mode 100644 index 000000000..6a79e6de5 --- /dev/null +++ b/splunk_add_on_ucc_framework/templates/Licenses/SPLUNK PRE-RELEASE SOFTWARE LICENSE AGREEMENT.txt @@ -0,0 +1,49 @@ +THIS PRE-RELEASE SOFTWARE LICENSE AGREEMENT (THE "AGREEMENT") GOVERNS YOUR USE OF THE PRE-RELEASE SOFTWARE (DEFINED BELOW) PROVIDED BY SPLUNK LLC, AND/OR ITS AFFILIATES ("SPLUNK”). YOU WILL BE REQUIRED TO INDICATE YOUR AGREEMENT TO THIS AGREEMENT IN ORDER TO ACCESS OR DOWNLOAD THE PRE-RELEASE SOFTWARE OR TO COMPLETE THE INSTALLATION PROCESS FOR THE PRE-RELEASE SOFTWARE. BY CLICKING ON THE "YES" OR “I ACCEPT” BUTTON (OR OTHER BUTTON OR MECHANISM DESIGNED TO ACKNOWLEDGE AGREEMENT TO THE TERMS OF THIS AGREEMENT), OR BY DOWNLOADING, ACCESSING OR INSTALLING THE PRE-RELEASE SOFTWARE, YOU ARE CONSENTING TO BE BOUND BY THIS AGREEMENT. + +NOTE: THIS IS THE ONLY AGREEMENT BETWEEN YOU AND SPLUNK GOVERNING YOUR USE OF THE PRE-RELEASE SOFTWARE, AND THIS AGREEMENT SHALL SUPERSEDE ANY OTHER TERMS OF USE OR LICENSE AGREEMENT THAT MAY APPEAR DURING THE INSTALLATION OR DOWNLOADING OF THE PRE-RELEASE SOFTWARE. + +IF YOU AGREE TO THESE TERMS ON BEHALF OF A BUSINESS, YOU REPRESENT AND WARRANT THAT YOU HAVE THE POWER AND AUTHORITY TO BIND THAT BUSINESS TO THIS AGREEMENT, AND YOUR AGREEMENT TO THESE TERMS WILL BE TREATED AS THE AGREEMENT OF THE BUSINESS. IN THAT EVENT, "YOU" AND "YOUR" REFER HEREIN TO THAT BUSINESS. + +IF YOU ARE UNWILLING TO AGREE TO THIS AGREEMENT, OR YOU DO NOT HAVE THE RIGHT, POWER AND AUTHORITY TO ACT ON BEHALF OF AND BIND YOUR BUSINESS, DO NOT CLICK ON THE BUTTON AND DO NOT INSTALL, DOWNLOAD, ACCESS, OR OTHERWISE USE THE PRE-RELEASE SOFTWARE AND CANCEL THE LOADING OF THE PRE-RELEASE SOFTWARE. + +1. DEFINITIONS. + +“Pre-Release Software” means the pre-release version of the Splunk product, service, technology identified on the software download page or landing page or invitation message (the “Cover Page”), whether labeled as alpha, beta, pre-release, preview or otherwise, provided to you by Splunk under this Agreement. Pre-Release Software may include any enhancements, updates, upgrades, derivatives or bug fixes to such product, service or technology and any documentation, add-ons, templates, sample data sets or hardware devices as provided by Splunk. + +“Data” means the raw data you upload or submit to the Pre-Release Software and the processed result of the raw data generated by you using the Pre-Release Software. + +“Feedback” means all suggestions, comments, opinions, code, input, ideas, reports, information, know-how or other feedback provided by you (whether in oral, electronic or written form) to Splunk in connection with your use of the Pre-Release Software. Feedback does not include Data, unless submitted or communicated by you to Splunk as part of Feedback. + +“Internal Purposes” means internal business use with your systems, networks, devices and data for the purposes of internal testing and evaluation of the Pre-Release Software in order to provide Feedback to Splunk regarding the Pre-Release Software. Such use does not include use of your systems, networks or devices as part of services you provide for a third party's benefit. + +2. PRE-RELEASE SOFTWARE LICENSE. Subject to your compliance with the terms and conditions of this Agreement, Splunk grants you a non-exclusive, non-sublicensable, nontransferable, revocable, limited license during the term of the Agreement to use a single copy of the Pre-Release Software at your principal office in a secure location, only in connection with and solely for the Internal Purposes. + +3. LICENSE RESTRICTIONS. Except as expressly authorized in this Agreement or by Splunk, you will not, and will not permit any third party to: (i) access or use the Pre-Release Software for any other purposes than the Internal Purposes (including for any competitive analysis, commercial, professional, or other for-profit purposes); (ii) copy the Pre-Release Software (except as required to run the Pre-Release Software and for reasonable backup purposes); (iii) modify, adapt, or create derivative works of the Pre-Release Software; (iv) rent, lease, loan, resell, transfer, sublicense or distribute the Pre-Release Software to any third party; (v) use or offer any functionality of the Pre-Release Software on a service provider, service bureau, hosted, software as a service, or time sharing basis; (vi) decompile, disassemble or reverse-engineer the Pre-Release Software or otherwise attempt to derive the Pre-Release Software source code, algorithms, methods or techniques used or embodied in the Pre-Release Software; (vii) disclose to any third party the results of any benchmark tests or other evaluation of the Pre-Release Software, or (viii) remove, alter, obscure, cover or change any trademark, copyright or other proprietary notices, labels or markings from or on the Pre-Release Software; (ix) interfere with or disrupt servers or networks connected to any website through which the Pre-Release Software provided; or (x) use the Pre-Release Software to collect or store personal data about any person or entity. Any consultant, contractor, or agent hired to perform services for you may operate the Pre-Release Software on your behalf under these terms and conditions, provided that: (a) you are responsible for ensuring that any such third party agrees to abide by and fully comply with the terms of this Agreement on the same basis as applicable to you; (b) such use is only in connection with your Internal Purposes; (c) such use does not represent or constitute an increase in the scope of the licenses provided hereunder; and (d) you remain fully liable for any and all acts or omissions by such third parties related to this Agreement. Any violation of this Section shall be a material breach of this Agreement subject to immediate termination of this Agreement for which no notice from Splunk shall be required. + +4. CONFIDENTIALITY. You agree to hold the Pre-Release Software (including all intellectual property rights therein, such as any patents, inventions, copyrights, design rights, trade secrets and know-how) and any related information (“Confidential Information”), whether in oral or written form, confidential. Confidential Information may include information relating to features, functionalities, improvements, code, pricing, business strategies, product roadmaps, development plans, marketing materials, data sets, customer lists or other proprietary third-party information. You will hold such Confidential Information in strict confidence and not use or disclose the Confidential Information, in whole or in part, except as expressly permitted in this Agreement. You may disclose Confidential Information to your employees, but only to the extent they have a need to know to test the Pre-Release Software and you have advised them that such information is Confidential. You agree to instruct any such employees in advance who will have access to the Pre-Release Software that they must comply with the restrictions set forth in this Agreement. You shall have no obligation to maintain the confidentiality of any information which: (a) is or becomes publicly available without breach of this Agreement; (b) is rightfully received by you from a third party without an obligation of confidentiality and without breach of this Agreement; (c) is developed independently by you without access to or use of the Confidential Information; or (d) has been approved for release by written authorization of the party that owns the Confidential Information. You will notify immediately upon discovery of any unauthorized use or disclosure of Confidential Information or any other breach of this Agreement by you or your personnel, and will cooperate with Splunk in every reasonable way to help Splunk regain possession of the Confidential Information and prevent its further unauthorized use or disclosure. You acknowledge that any breach of its obligations under this Agreement with respect to the proprietary rights or Confidential Information will cause Splunk irreparable injury for which there are inadequate remedies at law, and therefore, Splunk will be entitled to equitable relief in addition to all other remedies provided by this Agreement or available at law or in equity. + +5. TERM AND TERMINATION. This Agreement will be effective from the earlier of (a) the date it is accepted by you and (b) the date on which you first installed, downloaded or accessed a copy of the Pre-Release Software and shall continue until terminated. This Agreement may be terminated at any time by either party, with or without cause, effective upon notice of termination. This Agreement will terminate automatically upon the end of the Pre-Release Software project as identified on the Cover Page or upon commercial release (if any) of the Pre-Release Software, whichever is earlier. This is time-sensitive software, so it will stop functioning on the termination date. Upon termination, you will immediately cease all use of the Pre-Release Software and destroy the Pre-Release Software, or upon request by Splunk, return to Splunk the Pre-Release Software and other Confidential Information that are in your possession or control. Upon Splunk’s request, you will certify in writing that you have returned or destroyed all copies of the Pre-Release Software and Confidential Information. Sections 1, 3, 4, 6, 7, 8, 9, 10, 11, 15, and 16 will survive termination of this Agreement. + +6. OWNERSHIP. Splunk, its suppliers and/or its licensors own all worldwide right, title and interest in and to the Pre-Release Software, including all worldwide patent rights (including patent applications and disclosures); copyright rights (including copyrights, copyright registration and copy rights with respect to computer software, software design, software code, software architecture, firmware, programming tools, graphic user interfaces, reports, dashboard, business rules, use cases, screens, alerts, notifications, drawings, specifications and databases); moral rights; trade secrets and other rights with respect to confidential or proprietary information; know-how; other rights with respect to inventions, discoveries, ideas, improvements, techniques, formulae, algorithms, processes, schematics, testing procedures, technical information and other technology; and any other intellectual and industrial property rights, whether or not subject to registration or protection; and all rights under any license or other arrangement with respect to the foregoing. Except as expressly stated in this Agreement, Splunk does not grant you any intellectual property rights in the Pre-Release Software, and all right, title, and interest in and to all copies of the Pre-Release Software not expressly granted remain with Splunk, its suppliers and/or its licensors. The Pre-Release Software is copyrighted and protected by the laws of the United States and other countries, and international treaty provisions. You acknowledge that the Pre-Release Software is licensed and not sold. + +7. FEEDBACK. Splunk, in its sole discretion, may or may not respond to your Feedback or promise to address all your Feedback in the development of future features or functionalities of the Pre-Release Software or any related or subsequent versions of such Pre-Release Software. In the event Splunk uses your Feedback, you grant Splunk an unrestricted, perpetual, worldwide, exclusive, transferable, irrevocable, sublicensable, royalty-free, fully paid-up license to use, copy, modify, create derivative works of, make, have made, distribute (through multiple tiers of distribution), publicly perform or display, import, export, sell, offer to sell, rent, or license copies of the Feedback as part of or in connection with any Splunk product, service, technology, content, material, specification or documentation. You warrant that the Feedback does not infringe any copyright or trade secret of any third party, and that you have no knowledge of any patent of any third party that may be infringed by the Feedback (including any implementation thereof recommended by you). You further warrant that your Feedback is not subject to any license terms that would purport to require Splunk to comply with any additional obligations with respect to any Splunk product or service that incorporates your Feedback. + +8. DATA. You hereby grant Splunk a perpetual, irrevocable, non-exclusive, royalty-free, paid-up, worldwide, sublicensable license to use, access, transmit, host, store, and display the Data solely for the purpose of providing and improving the Pre-Release Software. Splunk (or its sublicensees) may exercise such license for purposes of providing, maintaining, repairing, administering and improving the Pre-Release Software or in developing new products or services, including rights to extract, compile, aggregate, synthesize, use, and otherwise analyze all or any portion of the Data. You represent, warrant and agree that the Data and other materials you provide or make available to Splunk will include only information relevant to the Pre-Release Software and the use thereof and will not include any personally identifiable information or any protected health data. You acknowledge and agree that you are solely responsible for all Data you upload or submit using the Pre-Release Software and for your conduct while using the Pre-Release Software. You acknowledge and agree that: (a) you will evaluate and bear all risks associated with the use of any Data; (b) you are responsible for protecting and backing up the Data; (c) you are responsible for protecting the confidentiality of any Data; and (d) under no circumstances will Splunk be liable in any way for any Data, including, but not limited to, any errors or omissions in any Data, or any loss or damages or any kind incurred as a result of your use, deletion, modification, or correction of any Data. Splunk has no responsibility to store, protect, remove or delete any Data for you and shall have no liability for the deletion of or failure to store any Data. + +9. WARRANTY DISCLAIMER. THE PRE-RELEASE SOFTWARE IS PROVIDED “AS IS”. SPLUNK DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, QUIET ENJOYMENT AND WARRANTIES ARISING OUT OF COURSE OF DEALING OR USAGE OF TRADE OR BY STATUTE OR IN LAW. SPLUNK SPECIFICALLY DOES NOT WARRANT THAT THE PRE-RELEASE SOFTWARE WILL MEET YOUR REQUIREMENTS, THE OPERATION OR OUTPUT OF THE PRE-RELEASE SOFTWARE WILL BE ERROR-FREE, ACCURATE, RELIABLE, COMPLETE OR UNINTERRUPTED. Splunk is not obligated to support, update or upgrade the Pre-Release Software. + +10. NO RELIANCE. Splunk has no obligations about any forward-looking statements made in connection with or in the course of providing the Pre-Release Software. Forward-looking statements are statements regarding future Splunk events, product offerings, product performance, customer uses or the expected financial performance of Splunk. Any such statements reflect current expectations and estimates based on factors currently known and that actual events or results could differ materially. Splunk does not assume any obligation to update any forward-looking statements made during the Pre-Release Software project. In addition, any information about our roadmap outlines our general product direction and is subject to change at any time without notice. It is for informational purposes only and shall not be incorporated into this Agreement or any contract or other commitment. Splunk undertakes no obligation either to develop the features or functionality described in the forward-looking statement or to include any such feature or functionality in a future release, including those you are reviewing as a part of this Pre-Release Software. You expressly acknowledge that the Pre-Release Software has not been fully tested and may contain defects or deficiencies which may not be corrected by Splunk, that the Pre-Release Software may undergo significant changes prior to release of the corresponding generally available final version. + +11. LIMITATION OF LIABILITY. IN NO EVENT WILL SPLUNK BE LIABLE TO YOU FOR ANY SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL OR PUNITIVE DAMAGES (INCLUDING LOSS OF USE, DATA, OR PROFITS, BUSINESS INTERRUPTION, OR COSTS OF PROCURING SUBSTITUTE PRE-RELEASE SOFTWARE) ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT OR THE USE OR PERFORMANCE OF THE PRE-RELEASE SOFTWARE, WHETHER SUCH LIABILITY ARISES FROM CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, AND WHETHER OR NOT SPLUNK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE. THE PARTIES HAVE AGREED THAT THESE LIMITATIONS WILL SURVIVE AND APPLY EVEN IF ANY REMEDY IS FOUND TO HAVE FAILED OF ITS ESSENTIAL PURPOSE. WITHOUT LIMITING THE FOREGOING, SPLUNK WILL HAVE NO LIABILITY OR RESPONSIBILITY FOR ANY BUSINESS INTERRUPTION OR LOSS OF DATA ARISING FROM THE AUTOMATIC TERMINATION OF THE LICENSE RIGHTS GRANTED HEREIN AND ANY ASSOCIATED CESSATION OF THE PRE-RELEASE SOFTWARE FUNCTIONS OR ANY UNANTICIPATED OR UNSCHEDULED DOWNTIME FOR ANY REASON OR ANY DELETION, CORRUPTION OR DAMAGE OF DATA ON OR THROUGH THE PRE-RELEASE SOFTWARE. SPLUNK'S TOTAL CUMULATIVE LIABILITY TO YOU, FROM ALL CAUSES OF ACTION AND ALL THEORIES OF LIABILITY, WILL BE LIMITED TO AND WILL NOT EXCEED ONE HUNDRED DOLLARS ($100.00). BECAUSE SOME STATES OR JURISDICTIONS DO NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU. + +12. PRIVACY. You acknowledge that Splunk and its providers may obtain information and data from you in connection with your registration, installation, and use of the Pre-Release Software, including, without limitation, personal information. Splunk may also collect and process technical and related environmental or performance information about your use of the Pre-Release Software (which may include, without limitation, data ingest volume, search concurrency, number of unique user log-ins, Internet protocol addresses, operating system, configuration information, application software, session duration, page view, operational use, and other such information) and use this information to support and troubleshoot issues, provide updates, analyze trends and improve Splunk’s products or services. You hereby consent to Splunk and its providers maintaining, using, storing and disclosing such information and data (including, without limitation, personal information, if any, in conformity with Splunk Privacy Policy, which may be updated from time to time). You further consent to receiving electronic communications and notifications from Splunk in connection with your use of the Pre-Release Software. + +13. EXPORT. You will comply fully with all relevant export laws and regulations of the United States and any other country (“Export Laws”) where you use any of the Pre-Release Software. You represent and warrant that you are not (a) located in, or a resident or a national of, a restricted country; or (b) on any of the relevant U.S. Government Lists of prohibited persons, including but not limited to the Treasury Department’s List of Specially Designated Nationals and the Commerce Department’s List of Denied Persons or Entity List. You further represent and warrant that you shall not export, re-export, ship, transfer the Pre-Release Software to any restricted countries or restricted end users or use the Pre-Release Software in any restricted countries or for any purposes prohibited by the Export Laws, including, but not limited to, nuclear, chemical, missile or biological weapons related end uses. You understand that the requirements and restrictions of the Export Laws may vary depending on the specific Pre-Release Software and may change over time, and that, to determine the precise controls applicable to the Pre-Release Software, it is necessary to refer to the U.S. Export Administration Regulations and the U.S. Department of Treasury, Office of Foreign Assets Control Regulations. + +14. GOVERNMENT END USER RIGHTS. You acknowledge that all Pre-Release Software and Confidential Information were developed entirely at private expense and that no part of the Pre-Release Software or Confidential Information was first produced in the performance of a Government contract. You agree that the Pre-Release Software and any derivatives thereof are "commercial items" as defined in 48 C.F.R. § 2.101, and if you are a U.S. Government agency or instrumentality or if you are providing all or any part of the Pre-Release Software or any derivatives thereof to the U.S. Government, such use, duplication, reproduction, release, modification, disclosure or transfer of this commercial product and data, is restricted in accordance with 48 C.F.R. § 12.211, 48 C.F.R. § 12.212, 48 C.F.R. § 227.7102-2, and 48 C.F.R. § 227.7202, as applicable. Consistent with 48 C.F.R. § 12.211, 48 C.F.R. § 12.212, 48 C.F.R. § 227.7102-1 through 48 C.F.R. § 227.7102-3, and 48 C.F.R. §§ 227.7202-1 through 227.7202-4, as applicable, the Pre-Release Software is licensed to U.S. Government end users (i) only as Commercial Items and (ii) with only those rights as are granted to all other users pursuant to this Agreement and any related agreement(s), as applicable. Accordingly, you will have no rights in the Pre-Release Software except as expressly agreed to in writing by you and Splunk. + +15. CHOICE OF LAW AND DISPUTES. For other than the U.S. Government as a party, this Agreement shall be governed by and construed in accordance with the laws of the State of California, as if performed wholly within the state and without giving effect to the principles of conflict of law rules of any jurisdiction or the United Nations Convention on Contracts for the International Sale of Goods, the application of which is expressly excluded. Any legal action or proceeding arising under this Agreement will be brought exclusively in the federal or state courts located in San Francisco, California and the parties hereby consent to personal jurisdiction and venue therein. + +16. GENERAL. All notices required or permitted under this Agreement hereto will be in writing and delivered in person, by confirmed facsimile transmission, by overnight delivery service, or by registered or certified mail, postage prepaid with return receipt requested, and in each instance will be deemed given upon receipt. You may not assign, delegate or transfer this Agreement, in whole or in part, by agreement, operation of law or otherwise. You acknowledge that Splunk may assign, subcontract or delegate any of its rights or obligations under this Agreement. Any attempt to assign this Agreement other than as permitted herein shall be null and void. Subject to the foregoing, this Agreement will bind and inure to the benefit of the parties’ permitted successors and assigns. This Agreement along with any additional terms incorporated herein by reference constitute the complete and exclusive understanding and agreement between the parties relating only to the subject matter of the Pre-Release Software and Confidential Information and shall supersede any and all prior or contemporaneous agreements, communications and understandings, written or oral, relating to such subject matter. This Agreement is limited to the use of Pre-Release Software and Confidential Information and as such, this Agreement is separate from and shall have no effect on any other agreement you may have with Splunk. Any waiver, modification or amendment of any provision of this Agreement will be effective only if in writing and signed by duly authorized representatives of both parties. All rights and remedies, whether conferred hereunder or by any other instrument or law, will be cumulative and may be exercised singularly or concurrently. The failure by either party to enforce any provisions of this Agreement will not constitute a waiver of any other right hereunder or of any subsequent enforcement of that or any other provisions. The terms and conditions stated herein are declared to be severable. If a court of competent jurisdiction holds any provision of this Agreement invalid or unenforceable, the remaining provisions of the Agreement will remain in full force and effect, and the provision affected will be construed so as to be enforceable to the maximum extent permissible by law. + +Updated February 16, 2017 \ No newline at end of file diff --git a/splunk_add_on_ucc_framework/templates/app.manifest.init-template b/splunk_add_on_ucc_framework/templates/app.manifest.init-template index 16a839b2c..c3d05058c 100644 --- a/splunk_add_on_ucc_framework/templates/app.manifest.init-template +++ b/splunk_add_on_ucc_framework/templates/app.manifest.init-template @@ -25,8 +25,13 @@ }, "commonInformationModels": null, "license": { - "name": null, - "text": "LICENSE.txt", + {% if add_license -%} + "name": "{{add_license}}", + "text": "./LICENSES/{{add_license}}.txt", + {%- else -%} + "name": "LICENSE.txt", + "text": "./LICENSES/LICENSE.txt", + {%- endif %} "uri": null }, "privacyPolicy": { diff --git a/splunk_add_on_ucc_framework/utils.py b/splunk_add_on_ucc_framework/utils.py index 5872de3bf..f0d364b8f 100644 --- a/splunk_add_on_ucc_framework/utils.py +++ b/splunk_add_on_ucc_framework/utils.py @@ -38,6 +38,10 @@ def get_j2_env() -> jinja2.Environment: ) +def get_license_path(file_name: str) -> str: + return join(dirname(__file__), "templates", "Licenses", f"{file_name}.txt") + + def recursive_overwrite(src: str, dest: str, ui_source_map: bool = False) -> None: """ Method to copy from src to dest recursively. diff --git a/tests/smoke/test_ucc_init.py b/tests/smoke/test_ucc_init.py index 6f462e9bb..87c2f37a7 100644 --- a/tests/smoke/test_ucc_init.py +++ b/tests/smoke/test_ucc_init.py @@ -17,6 +17,7 @@ def test_ucc_init(): "1.0.0", "demo-addon-for-splunk", overwrite=True, + add_license="MIT License", ) expected_folder = os.path.join( os.path.dirname(__file__), @@ -30,10 +31,10 @@ def test_ucc_init(): ("README.md",), ("globalConfig.json",), ("package", "README.txt"), - ("package", "LICENSE.txt"), ("package", "app.manifest"), ("package", "bin", "demo_input_helper.py"), ("package", "lib", "requirements.txt"), + ("package", "LICENSES", "MIT License.txt"), ] helpers.compare_file_content( files_to_be_equal, diff --git a/tests/testdata/expected_addons/expected_addon_after_init/demo_addon_for_splunk/package/LICENSES/MIT License.txt b/tests/testdata/expected_addons/expected_addon_after_init/demo_addon_for_splunk/package/LICENSES/MIT License.txt new file mode 100644 index 000000000..03e8bb5ab --- /dev/null +++ b/tests/testdata/expected_addons/expected_addon_after_init/demo_addon_for_splunk/package/LICENSES/MIT License.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright [yyyy] [name of copyright owner] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_addon_after_init/demo_addon_for_splunk/package/app.manifest b/tests/testdata/expected_addons/expected_addon_after_init/demo_addon_for_splunk/package/app.manifest index 13470c6d0..7c64a17c7 100644 --- a/tests/testdata/expected_addons/expected_addon_after_init/demo_addon_for_splunk/package/app.manifest +++ b/tests/testdata/expected_addons/expected_addon_after_init/demo_addon_for_splunk/package/app.manifest @@ -25,8 +25,8 @@ }, "commonInformationModels": null, "license": { - "name": null, - "text": "LICENSE.txt", + "name": "MIT License", + "text": "./LICENSES/MIT License.txt", "uri": null }, "privacyPolicy": { diff --git a/tests/testdata/expected_addons/expected_files_conflict_test/expected_log.json b/tests/testdata/expected_addons/expected_files_conflict_test/expected_log.json index 0aa40f75e..f6a38719c 100644 --- a/tests/testdata/expected_addons/expected_files_conflict_test/expected_log.json +++ b/tests/testdata/expected_addons/expected_files_conflict_test/expected_log.json @@ -2,7 +2,7 @@ "Detailed information about created/copied/modified/conflict files": "INFO", "Read more about it here: https://splunk.github.io/addonfactory-ucc-generator/quickstart/#verbose-mode": "INFO", "\u001b[33mapp.manifest modified\u001b[0m": "INFO", - "\u001b[32mLICENSE.txt copied\u001b[0m": "INFO", + "\u001b[32mLICENSES/LICENSE.txt copied\u001b[0m": "INFO", "\u001b[32mREADME.txt copied\u001b[0m": "INFO", "VERSION created\u001b[0m": "INFO", "\u001b[31mbin/import_declare_test.py conflict\u001b[0m": "INFO", diff --git a/tests/testdata/test_addons/package_global_config_everything/LICENSES/Apache-2.0.txt b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/LICENSES/Apache License 2.0.txt similarity index 100% rename from tests/testdata/test_addons/package_global_config_everything/LICENSES/Apache-2.0.txt rename to tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/LICENSES/Apache License 2.0.txt diff --git a/tests/testdata/test_addons/package_files_conflict_test/package/LICENSE.txt b/tests/testdata/test_addons/package_files_conflict_test/package/LICENSE.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/testdata/expected_addons/expected_addon_after_init/demo_addon_for_splunk/package/LICENSE.txt b/tests/testdata/test_addons/package_files_conflict_test/package/LICENSES/LICENSE.txt similarity index 100% rename from tests/testdata/expected_addons/expected_addon_after_init/demo_addon_for_splunk/package/LICENSE.txt rename to tests/testdata/test_addons/package_files_conflict_test/package/LICENSES/LICENSE.txt diff --git a/tests/testdata/test_addons/package_global_config_everything/package/LICENSES/Apache License 2.0.txt b/tests/testdata/test_addons/package_global_config_everything/package/LICENSES/Apache License 2.0.txt new file mode 100644 index 000000000..4ed90b952 --- /dev/null +++ b/tests/testdata/test_addons/package_global_config_everything/package/LICENSES/Apache License 2.0.txt @@ -0,0 +1,208 @@ +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, +AND DISTRIBUTION + + 1. Definitions. + + + +"License" shall mean the terms and conditions for use, reproduction, and distribution +as defined by Sections 1 through 9 of this document. + + + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + + + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct +or indirect, to cause the direction or management of such entity, whether +by contract or otherwise, or (ii) ownership of fifty percent (50%) or more +of the outstanding shares, or (iii) beneficial ownership of such entity. + + + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions +granted by this License. + + + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + + + +"Object" form shall mean any form resulting from mechanical transformation +or translation of a Source form, including but not limited to compiled object +code, generated documentation, and conversions to other media types. + + + +"Work" shall mean the work of authorship, whether in Source or Object form, +made available under the License, as indicated by a copyright notice that +is included in or attached to the work (an example is provided in the Appendix +below). + + + +"Derivative Works" shall mean any work, whether in Source or Object form, +that is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative +Works shall not include works that remain separable from, or merely link (or +bind by name) to the interfaces of, the Work and Derivative Works thereof. + + + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative +Works thereof, that is intentionally submitted to Licensor for inclusion in +the Work by the copyright owner or by an individual or Legal Entity authorized +to submit on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication +sent to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor +for the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + + + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently incorporated +within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this +License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license to reproduce, prepare +Derivative Works of, publicly display, publicly perform, sublicense, and distribute +the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, +each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) patent +license to make, have made, use, offer to sell, sell, import, and otherwise +transfer the Work, where such license applies only to those patent claims +licensable by such Contributor that are necessarily infringed by their Contribution(s) +alone or by combination of their Contribution(s) with the Work to which such +Contribution(s) was submitted. If You institute patent litigation against +any entity (including a cross-claim or counterclaim in a lawsuit) alleging +that the Work or a Contribution incorporated within the Work constitutes direct +or contributory patent infringement, then any patent licenses granted to You +under this License for that Work shall terminate as of the date such litigation +is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or +Derivative Works thereof in any medium, with or without modifications, and +in Source or Object form, provided that You meet the following conditions: + +(a) You must give any other recipients of the Work or Derivative Works a copy +of this License; and + +(b) You must cause any modified files to carry prominent notices stating that +You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source +form of the Work, excluding those notices that do not pertain to any part +of the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its distribution, +then any Derivative Works that You distribute must include a readable copy +of the attribution notices contained within such NOTICE file, excluding those +notices that do not pertain to any part of the Derivative Works, in at least +one of the following places: within a NOTICE text file distributed as part +of the Derivative Works; within the Source form or documentation, if provided +along with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents +of the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works +that You distribute, alongside or as an addendum to the NOTICE text from the +Work, provided that such additional attribution notices cannot be construed +as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, +or distribution of Your modifications, or for any such Derivative Works as +a whole, provided Your use, reproduction, and distribution of the Work otherwise +complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any +Contribution intentionally submitted for inclusion in the Work by You to the +Licensor shall be under the terms and conditions of this License, without +any additional terms or conditions. Notwithstanding the above, nothing herein +shall supersede or modify the terms of any separate license agreement you +may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, +trademarks, service marks, or product names of the Licensor, except as required +for reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to +in writing, Licensor provides the Work (and each Contributor provides its +Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied, including, without limitation, any warranties +or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR +A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness +of using or redistributing the Work and assume any risks associated with Your +exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether +in tort (including negligence), contract, or otherwise, unless required by +applicable law (such as deliberate and grossly negligent acts) or agreed to +in writing, shall any Contributor be liable to You for damages, including +any direct, indirect, special, incidental, or consequential damages of any +character arising as a result of this License or out of the use or inability +to use the Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all other commercial +damages or losses), even if such Contributor has been advised of the possibility +of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work +or Derivative Works thereof, You may choose to offer, and charge a fee for, +acceptance of support, warranty, indemnity, or other liability obligations +and/or rights consistent with this License. However, in accepting such obligations, +You may act only on Your own behalf and on Your sole responsibility, not on +behalf of any other Contributor, and only if You agree to indemnify, defend, +and hold each Contributor harmless for any liability incurred by, or claims +asserted against, such Contributor by reason of your accepting any such warranty +or additional liability. END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own identifying +information. (Don't include the brackets!) The text should be enclosed in +the appropriate comment syntax for the file format. We also recommend that +a file or class name and description of purpose be included on the same "printed +page" as the copyright notice for easier identification within third-party +archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); + +you may not use this file except in compliance with the License. + +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software + +distributed under the License is distributed on an "AS IS" BASIS, + +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +See the License for the specific language governing permissions and + +limitations under the License. diff --git a/tests/testdata/test_addons/package_global_config_everything_uccignore/LICENSES/Apache-2.0.txt b/tests/testdata/test_addons/package_global_config_everything_uccignore/LICENSES/Apache-2.0.txt deleted file mode 100644 index 33195b0f8..000000000 --- a/tests/testdata/test_addons/package_global_config_everything_uccignore/LICENSES/Apache-2.0.txt +++ /dev/null @@ -1 +0,0 @@ -dummy apache license \ No newline at end of file diff --git a/tests/testdata/test_addons/package_global_config_everything_uccignore/package/LICENSES/Apache License 2.0.txt b/tests/testdata/test_addons/package_global_config_everything_uccignore/package/LICENSES/Apache License 2.0.txt new file mode 100644 index 000000000..775f420fa --- /dev/null +++ b/tests/testdata/test_addons/package_global_config_everything_uccignore/package/LICENSES/Apache License 2.0.txt @@ -0,0 +1 @@ +test Apache license diff --git a/tests/unit/commands/test_init.py b/tests/unit/commands/test_init.py index 74bcf3166..c5f221e2e 100644 --- a/tests/unit/commands/test_init.py +++ b/tests/unit/commands/test_init.py @@ -93,6 +93,7 @@ def test__is_valid_input_name(input_name, expected): "0.0.1", "addon_name", False, + None, ), ), ( @@ -110,6 +111,7 @@ def test__is_valid_input_name(input_name, expected): "0.0.1", "addon_name", False, + None, ), ), ( @@ -119,6 +121,7 @@ def test__is_valid_input_name(input_name, expected): "addon_display_name": "Addon For Demo", "addon_input_name": "input_name", "addon_version": "0.0.1", + "add_license": "Apache License 2.0", }, ( "addon_name", @@ -127,6 +130,7 @@ def test__is_valid_input_name(input_name, expected): "0.0.1", "addon_rest_root", False, + "Apache License 2.0", ), ), ], diff --git a/tests/unit/test_main.py b/tests/unit/test_main.py index 6b8d187eb..73a6e8923 100644 --- a/tests/unit/test_main.py +++ b/tests/unit/test_main.py @@ -348,6 +348,7 @@ def test_build_command(mock_ucc_gen_generate, args, expected_parameters): "addon_version": "0.0.1", "addon_rest_root": None, "overwrite": False, + "add_license": None, }, ), ( @@ -361,6 +362,8 @@ def test_build_command(mock_ucc_gen_generate, args, expected_parameters): "Splunk Add-on for Demo", "--addon-input-name", "demo_input", + "--add-license", + "MIT License", ], { "addon_name": "splunk_add_on_for_demo", @@ -369,6 +372,7 @@ def test_build_command(mock_ucc_gen_generate, args, expected_parameters): "addon_version": "0.0.1", "addon_rest_root": "splunk_add_on_for_demo", "overwrite": False, + "add_license": "MIT License", }, ), ], @@ -380,6 +384,25 @@ def test_init_command(mock_init_command, args, expected_parameters): mock_init_command.assert_called_with(**expected_parameters) +@pytest.mark.parametrize( + "args", + [ + ( + { + "addon_name": "splunk_add_on_for_demo", + "addon_display_name": "Addon For Demo", + "addon_input_name": "input_name", + "addon_version": "0.0.1", + "add_license": "Apache License", + } + ), + ], +) +def test_init_command_incorrect_license(args): + with pytest.raises(SystemExit): + main.main(args) + + @pytest.mark.parametrize( "args,expected_parameters", [ diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index a10bda04a..33a97831f 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -3,6 +3,7 @@ import dunamai import pytest +from unittest.mock import patch from splunk_add_on_ucc_framework import exceptions, utils @@ -35,6 +36,14 @@ def test_get_j2_env(): assert sorted(expected_list_of_templates) == sorted(list_of_templates) +@patch("splunk_add_on_ucc_framework.utils.__file__", "/mocked/path/utils") +def test_get_license_path(): + file_name = "example_license" + expected_path = "/mocked/path/templates/Licenses/example_license.txt" + actual_path = utils.get_license_path(file_name) + assert actual_path == expected_path + + @mock.patch("splunk_add_on_ucc_framework.utils.dunamai.Version", autospec=True) def test_get_version_from_git_when_runtime_error_from_dunamai(mock_version_class): mock_version_class.from_git.side_effect = RuntimeError