-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate metadata/default.meta
- Loading branch information
Showing
10 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# Copyright 2021 Splunk Inc. | ||
# | ||
# 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. | ||
# | ||
from typing import IO | ||
|
||
from . import conf_parser | ||
|
||
DEFAULT = """ | ||
# Application-level permissions | ||
[] | ||
owner = admin | ||
access = read : [ * ], write : [ admin ] | ||
export = system | ||
""" | ||
|
||
|
||
class MetaConf: | ||
def __init__(self): | ||
self._meta_conf = conf_parser.TABConfigParser() | ||
|
||
def create_default(self, fd: IO) -> None: | ||
self._meta_conf.read_string(DEFAULT) | ||
self._meta_conf.write(fd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
tests/data/package_global_config_inputs_configuration_alerts/package/metadata/default.meta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Application-level permissions | ||
|
||
[] | ||
owner = admin | ||
access = read : [ * ], write : [ admin ] | ||
export = system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
tests/expected_output_global_config_configuration/Splunk_TA_UCCExample/metadata/default.meta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Application-level permissions | ||
|
||
[] | ||
owner = admin | ||
access = read : [ * ], write : [ admin ] | ||
export = system |
7 changes: 7 additions & 0 deletions
7
...tput_global_config_inputs_configuration_alerts/Splunk_TA_UCCExample/metadata/default.meta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Application-level permissions | ||
|
||
[] | ||
owner = admin | ||
access = read : [ * ], write : [ admin ] | ||
export = system |
7 changes: 7 additions & 0 deletions
7
tests/expected_output_no_global_config/Splunk_TA_UCCExample/metadata/default.meta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Application-level permissions | ||
|
||
[] | ||
owner = admin | ||
access = read : [ * ], write : [ admin ] | ||
export = system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# Copyright 2021 Splunk Inc. | ||
# | ||
# 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. | ||
# | ||
import io | ||
import unittest | ||
|
||
from splunk_add_on_ucc_framework import meta_conf | ||
|
||
|
||
class MetaConfTest(unittest.TestCase): | ||
def test_update(self): | ||
meta_config = meta_conf.MetaConf() | ||
actual_output = io.StringIO() | ||
meta_config.create_default(actual_output) | ||
expected_output = meta_conf.DEFAULT | ||
self.assertEqual(expected_output, actual_output.getvalue()) |