First set of working module structure
This commit is contained in:
commit
aa73290eb2
13
main.py
Normal file
13
main.py
Normal file
@ -0,0 +1,13 @@
|
||||
import os, sys
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), "lib"))
|
||||
|
||||
import myOpenstackApp
|
||||
|
||||
|
||||
y=myOpenstackApp.OSC
|
||||
y.initalise()
|
||||
# y.ks.getCatalog()
|
||||
y.something()
|
||||
# print(y._keystone)
|
||||
|
||||
print("Starting")
|
27
myOpenstackApp/OpenStackConnection.py
Normal file
27
myOpenstackApp/OpenStackConnection.py
Normal file
@ -0,0 +1,27 @@
|
||||
class OpenStackConnection_x:
|
||||
someProp=0
|
||||
ks=False
|
||||
nova=False
|
||||
|
||||
catalogData=""
|
||||
novaURL=""
|
||||
|
||||
"""
|
||||
It's important not to initalise any of the submodules during the init cycle becuase thic causes cirtucalr import loops
|
||||
The initalise function exists for this reas and should be caled by the client application using this module
|
||||
"""
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
def initalise(self) -> None:
|
||||
from myOpenstackApp.keystone import myopenstack_keystone
|
||||
from myOpenstackApp.nova import myopenstack_nova
|
||||
|
||||
self.ks=myopenstack_keystone(self)
|
||||
self.nova=myopenstack_nova(self)
|
||||
pass
|
||||
|
||||
def something(_self):
|
||||
print(1)
|
||||
_self.ks.getCatalog()
|
||||
_self.nova.showNovaURL()
|
3
myOpenstackApp/__init__.py
Normal file
3
myOpenstackApp/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
from myOpenstackApp import OpenStackConnection
|
||||
|
||||
OSC=OpenStackConnection.OpenStackConnection_x()
|
BIN
myOpenstackApp/__pycache__/OpenStackConnection.cpython-310.pyc
Normal file
BIN
myOpenstackApp/__pycache__/OpenStackConnection.cpython-310.pyc
Normal file
Binary file not shown.
BIN
myOpenstackApp/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
myOpenstackApp/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
myOpenstackApp/__pycache__/keystone.cpython-310.pyc
Normal file
BIN
myOpenstackApp/__pycache__/keystone.cpython-310.pyc
Normal file
Binary file not shown.
BIN
myOpenstackApp/__pycache__/nova.cpython-310.pyc
Normal file
BIN
myOpenstackApp/__pycache__/nova.cpython-310.pyc
Normal file
Binary file not shown.
16
myOpenstackApp/keystone.py
Normal file
16
myOpenstackApp/keystone.py
Normal file
@ -0,0 +1,16 @@
|
||||
import myOpenstackApp.OpenStackConnection
|
||||
|
||||
|
||||
class myopenstack_keystone():
|
||||
|
||||
def __init__(self,conn ) -> None:
|
||||
self.conn=conn
|
||||
|
||||
def echo(_self):
|
||||
print("Helllooo")
|
||||
|
||||
|
||||
def getCatalog(_self):
|
||||
catalog="Some shit, more shit"
|
||||
_self.conn.catalogData=catalog
|
||||
_self.conn.novaURL="http://nova"
|
17
myOpenstackApp/nova.py
Normal file
17
myOpenstackApp/nova.py
Normal file
@ -0,0 +1,17 @@
|
||||
import myOpenstackApp.OpenStackConnection
|
||||
|
||||
|
||||
class myopenstack_nova():
|
||||
|
||||
def __init__(self,conn: myOpenstackApp.OpenStackConnection.OpenStackConnection_x ) -> None:
|
||||
self.conn=conn
|
||||
|
||||
def addNewVM(_self,Name, flavor):
|
||||
return(Name)
|
||||
|
||||
def getKeystone(_self):
|
||||
_self.myOpenstackObject.keystone.echo()
|
||||
|
||||
def showNovaURL(_self):
|
||||
print(_self.conn.novaURL)
|
||||
_self.conn
|
Loading…
x
Reference in New Issue
Block a user