begin work on python implementation
This commit is contained in:
parent
d2be89ee45
commit
b4e9e94f2c
11 changed files with 87 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
__pycache__/
|
4
.idea/.gitignore
vendored
Normal file
4
.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
|
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
10
.idea/kiwi-config.iml
Normal file
10
.idea/kiwi-config.iml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
4
.idea/misc.xml
Normal file
4
.idea/misc.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3" project-jdk-type="Python SDK" />
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/kiwi-config.iml" filepath="$PROJECT_DIR$/.idea/kiwi-config.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
12
src/etc/default.kiwi.yml
Normal file
12
src/etc/default.kiwi.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
version: 0.1
|
||||
|
||||
suffix:
|
||||
project: .project
|
||||
down: .down
|
||||
|
||||
docker:
|
||||
net: kiwinet
|
||||
cidr: 10.22.46.0/24
|
||||
|
||||
target:
|
||||
root: /var/kiwi
|
20
src/kiwi-config.py
Normal file
20
src/kiwi-config.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
from kiwi import *
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='kiwi-config')
|
||||
parser.add_argument('cmd', metavar='command', type=str, help='subcommand to execute')
|
||||
|
||||
args = parser.parse_args()
|
||||
print(args.cmd)
|
||||
|
||||
cf = config.Config.default()
|
||||
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
1
src/kiwi/__init__.py
Normal file
1
src/kiwi/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
__all__ = ['config']
|
15
src/kiwi/config.py
Normal file
15
src/kiwi/config.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
class Config:
|
||||
# version, suffix_project, suffix_down, docker_net, docker_cidr, target_root = None
|
||||
|
||||
def __init__(self, filename):
|
||||
import yaml
|
||||
|
||||
with open(filename, 'r') as stream:
|
||||
try:
|
||||
print(yaml.safe_load(stream))
|
||||
except yaml.YAMLError as exc:
|
||||
print(exc)
|
||||
|
||||
@classmethod
|
||||
def default(cls):
|
||||
return cls("./etc/default.kiwi.yml")
|
Loading…
Reference in a new issue