mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
rework all the templates to not use cookiecutter
This commit is contained in:
parent
ffe3f51446
commit
b3ee6c60e5
12 changed files with 39 additions and 71 deletions
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"full_name": "",
|
||||
"email": "",
|
||||
"project_name": "project_name",
|
||||
"project_slug": "salt",
|
||||
"repo_name": "project_name",
|
||||
"project_short_description": "short_description",
|
||||
"release_date": "2016-06-06",
|
||||
"year": "2016",
|
||||
"version": "Carbon",
|
||||
"open_source_license": ["Apache Software License 2.0"]
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
{{cookiecutter.project_name}} execution module
|
||||
{{module_name}} execution module
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
{{cookiecutter.project_short_description}}
|
||||
{{short_description}}
|
||||
|
||||
.. versionadded:: {{cookiecutter.version}}
|
||||
.. versionadded:: {{version}}
|
||||
|
||||
:configuration:
|
||||
|
||||
|
@ -37,7 +37,7 @@ except ImportError as ie:
|
|||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
__virtualname__ = '{{cookiecutter.project_name}}'
|
||||
__virtualname__ = '{{module_name}}'
|
||||
|
||||
|
||||
def __virtual__():
|
||||
|
@ -46,7 +46,7 @@ def __virtual__():
|
|||
'''
|
||||
if HAS_LIBS:
|
||||
return __virtualname__
|
||||
return (False, 'The {{cookiecutter.project_name}} execution module failed to load:'
|
||||
return (False, 'The {{module_name}} execution module failed to load:'
|
||||
'import error - {0}.'.format(missing_package))
|
||||
|
||||
|
4
templates/module/template.json
Normal file
4
templates/module/template.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"description": "Execution module",
|
||||
"version": "Carbon",
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"full_name": "",
|
||||
"email": "",
|
||||
"project_name": "project_name",
|
||||
"project_slug": "tests",
|
||||
"repo_name": "project_name",
|
||||
"project_short_description": "short_description",
|
||||
"release_date": "2016-06-06",
|
||||
"year": "2016",
|
||||
"version": "Carbon",
|
||||
"open_source_license": ["Apache Software License 2.0"]
|
||||
}
|
4
templates/module_test/template.json
Normal file
4
templates/module_test/template.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"description": "Execution module unit test",
|
||||
"version": "Carbon",
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
:codeauthor: :email:`{{cookiecutter.full_name}} <{{cookiecutter.email}}>`
|
||||
:codeauthor: :email:`{{full_name}} <{{email}}>`
|
||||
'''
|
||||
|
||||
# Import Python Libs
|
||||
|
@ -15,16 +15,16 @@ from salttesting.mock import (
|
|||
NO_MOCK_REASON
|
||||
)
|
||||
from salttesting.helpers import ensure_in_syspath
|
||||
from salt.states import {{cookiecutter.project_name}}
|
||||
from salt.modules import {{module_name}}
|
||||
|
||||
ensure_in_syspath('../../')
|
||||
|
||||
SERVICE_NAME = '{{cookiecutter.project_name}}'
|
||||
SERVICE_NAME = '{{module_name}}'
|
||||
{{cookiecutter.project_name}}.__salt__ = {}
|
||||
|
||||
|
||||
@skipIf(NO_MOCK, NO_MOCK_REASON)
|
||||
class {{cookiecutter.project_name|capitalize}}TestCase(ModuleTestCase):
|
||||
class {{module_name|capitalize}}TestCase(ModuleTestCase):
|
||||
def setUp(self):
|
||||
# Optionally, tell the tests that you have a module installed into sys.modules
|
||||
# hasDependency('library_name')
|
||||
|
@ -34,7 +34,7 @@ class {{cookiecutter.project_name|capitalize}}TestCase(ModuleTestCase):
|
|||
return {}
|
||||
|
||||
self.setup_loader()
|
||||
self.loader.set_result({{cookiecutter.project_name}}, 'config.option', get_config)
|
||||
self.loader.set_result({{module_name}}, 'config.option', get_config)
|
||||
|
||||
def test_behaviour(self):
|
||||
# Test inherent behaviours
|
||||
|
@ -42,5 +42,5 @@ class {{cookiecutter.project_name|capitalize}}TestCase(ModuleTestCase):
|
|||
|
||||
if __name__ == '__main__':
|
||||
from unit import run_tests
|
||||
run_tests({{cookiecutter.project_name|capitalize}}TestCase)
|
||||
run_tests({{module_name|capitalize}}TestCase)
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"full_name": "",
|
||||
"email": "",
|
||||
"project_name": "project_name",
|
||||
"project_slug": "salt",
|
||||
"repo_name": "project_name",
|
||||
"project_short_description": "short_description",
|
||||
"release_date": "2016-06-06",
|
||||
"year": "2016",
|
||||
"version": "Carbon",
|
||||
"open_source_license": ["Apache Software License 2.0"]
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
{{cookiecutter.project_name}} state module
|
||||
{{module_name}} state module
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
{{cookiecutter.project_short_description}}
|
||||
{{short_description}}
|
||||
|
||||
.. versionadded:: {{cookiecutter.version}}
|
||||
.. versionadded:: {{version}}
|
||||
|
||||
:configuration:
|
||||
|
||||
|
@ -37,7 +37,7 @@ except ImportError as ie:
|
|||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
__virtualname__ = '{{cookiecutter.project_name}}'
|
||||
__virtualname__ = '{{module_name}}'
|
||||
|
||||
|
||||
def __virtual__():
|
||||
|
@ -46,7 +46,7 @@ def __virtual__():
|
|||
'''
|
||||
if HAS_LIBS:
|
||||
return __virtualname__
|
||||
return (False, 'The {{cookiecutter.project_name}} execution module failed to load:'
|
||||
return (False, 'The {{module_name}} execution module failed to load:'
|
||||
'import error - {0}.'.format(missing_package))
|
||||
|
||||
|
4
templates/state/template.json
Normal file
4
templates/state/template.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"description": "State module",
|
||||
"version": "Carbon",
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"full_name": "",
|
||||
"email": "",
|
||||
"project_name": "project_name",
|
||||
"project_slug": "tests",
|
||||
"repo_name": "project_name",
|
||||
"project_short_description": "short_description",
|
||||
"release_date": "2016-06-06",
|
||||
"year": "2016",
|
||||
"version": "Carbon",
|
||||
"open_source_license": ["Apache Software License 2.0"]
|
||||
}
|
4
templates/state_test/template.json
Normal file
4
templates/state_test/template.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"description": "Unit tests for a state module",
|
||||
"version": "Carbon",
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
:codeauthor: :email:`{{cookiecutter.full_name}} <{{cookiecutter.email}}>`
|
||||
:codeauthor: :email:`{{full_name}} <{{email}}>`
|
||||
'''
|
||||
|
||||
# Import Python Libs
|
||||
|
@ -15,16 +15,16 @@ from salttesting.mock import (
|
|||
NO_MOCK_REASON
|
||||
)
|
||||
from salttesting.helpers import ensure_in_syspath
|
||||
from salt.modules import {{cookiecutter.project_name}}
|
||||
from salt.states import {{module_name}}
|
||||
|
||||
ensure_in_syspath('../../')
|
||||
|
||||
SERVICE_NAME = '{{cookiecutter.project_name}}'
|
||||
{{cookiecutter.project_name}}.__salt__ = {}
|
||||
SERVICE_NAME = '{{module_name}}'
|
||||
{{module_name}}.__salt__ = {}
|
||||
|
||||
|
||||
@skipIf(NO_MOCK, NO_MOCK_REASON)
|
||||
class {{cookiecutter.project_name|capitalize}}TestCase(ModuleTestCase):
|
||||
class {{module_name|capitalize}}TestCase(ModuleTestCase):
|
||||
def setUp(self):
|
||||
# Optionally, tell the tests that you have a module installed into sys.modules
|
||||
# hasDependency('library_name')
|
||||
|
@ -34,7 +34,7 @@ class {{cookiecutter.project_name|capitalize}}TestCase(ModuleTestCase):
|
|||
return {}
|
||||
|
||||
self.setup_loader()
|
||||
self.loader.set_result({{cookiecutter.project_name}}, 'config.option', get_config)
|
||||
self.loader.set_result({{module_name}}, 'config.option', get_config)
|
||||
|
||||
def test_behaviour(self):
|
||||
# Test inherent behaviours
|
||||
|
@ -42,5 +42,5 @@ class {{cookiecutter.project_name|capitalize}}TestCase(ModuleTestCase):
|
|||
|
||||
if __name__ == '__main__':
|
||||
from unit import run_tests
|
||||
run_tests({{cookiecutter.project_name|capitalize}}TestCase)
|
||||
run_tests({{module_name|capitalize}}TestCase)
|
||||
|
Loading…
Add table
Reference in a new issue