Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load write sync init (c)Vlad #44

Merged
merged 5 commits into from
Apr 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified lib/hardware_services/__init__.py
100644 → 100755
Empty file.
Empty file modified lib/hardware_services/inventory_drivers/HilInventoryDriver.py
100644 → 100755
Empty file.
12 changes: 12 additions & 0 deletions lib/hardware_services/inventory_drivers/MockInventoryDriver.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,16 @@ def list_clouds(self, quadsinstance):
def list_hosts(self, quadsinstance):
print "listing hosts"

def load_data(self, quadsinstance, force):
print("data is loaded")

def write_data(self, quadsinstance, doexit = True):
print("data is written")

def sync_state(self, quadsinstance):
print("data is synchronized")

def init_data(self, quadsinstance, force):
print("data is initialized")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vsemp can you just change the print statements to python 2.7 format? Besides that, i think this looks great! We can merge as soon as you fix the prints!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With parenthesis works for python 2 and 3.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vsemp ah sorry! I didn't realize that.



19 changes: 19 additions & 0 deletions lib/hardware_services/inventory_drivers/QuadsNativeInventoryDriver.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,23 @@ def list_clouds(self,quadsinstance):
def list_hosts(self,quadsinstance):
quadsinstance.quads.hosts.host_list()

def load_data(self, quadsinstance, force):
if initialize:
quadsinstance.quads_init_data(force)
try:
stream = open(quadsinstance.config, 'r')
quadsinstance.data = yaml.load(stream)
stream.close()
except Exception, ex:
quadsinstance.logger.error(ex)
exit(1)

def write_data(self, quadsinstance, doexit = True):
quadsinstance.quads_write_data(doexit)

def sync_state(self, quadsinstance):
quadsinstance.quads_sync_state()

def init_data(self, quadsinstance, force):
quadsinstance.quads_init_data(force)

Empty file modified lib/hardware_services/inventory_drivers/__init__.py
100644 → 100755
Empty file.
31 changes: 31 additions & 0 deletions lib/hardware_services/inventory_service.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,37 @@ def list_hosts(self):
""" TODO add documentation
"""

@abstractmethod
def load_data(self, quads, force):
# this code goes here for Juniper
# try:
# stream = open(config, 'r')
# self.data = yaml.load(stream)
# stream.close()
# except Exception, ex:
# self.logger.error(ex)
# exit(1)
""" TODO add documentation
"""

@abstractmethod
def init_data(self, quads, force):
# quads_init_data
""" TODO add documentation
"""

@abstractmethod
def sync_state(self, quads):
# quads_sync_data
""" TODO add documentation
"""

@abstractmethod
def write_data(self, quads, doexit = True):
# quads_write_data
""" TODO add documentation
"""


_inventory_service = None

Expand Down
Empty file modified lib/hardware_services/network_drivers/HilNetworkDriver.py
100644 → 100755
Empty file.
Empty file modified lib/hardware_services/network_drivers/MockNetworkDriver.py
100644 → 100755
Empty file.
Empty file.
Empty file modified lib/hardware_services/network_drivers/__init__.py
100644 → 100755
Empty file.
Empty file modified lib/hardware_services/network_service.py
100644 → 100755
Empty file.