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

fixed libquads Vlad #46

Closed
wants to merge 2 commits into from
Closed
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 .gitignore
100644 → 100755
Empty file.
Empty file modified .gitreview
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified __init__.py
100644 → 100755
Empty file.
Empty file modified ansible/racadm-setup-boot-r620-director.yml
100644 → 100755
Empty file.
Empty file modified ansible/racadm-setup-boot-r620-foreman.yml
100644 → 100755
Empty file.
Empty file modified ansible/racadm-setup-boot-r630-director.yml
100644 → 100755
Empty file.
Empty file modified ansible/racadm-setup-boot-r630-foreman.yml
100644 → 100755
Empty file.
Empty file modified ansible/racadm-setup-boot-r730xd-director.yml
100644 → 100755
Empty file.
Empty file modified ansible/racadm-setup-boot-r730xd-foreman.yml
100644 → 100755
Empty file.
Empty file modified ansible/racadm-setup-boot-r930-director.yml
100644 → 100755
Empty file.
Empty file modified ansible/racadm-setup-boot-r930-foreman.yml
100644 → 100755
Empty file.
Empty file modified bin/__init__.py
100644 → 100755
Empty file.
Empty file modified bin/quads-validate-env.sh
100644 → 100755
Empty file.
Empty file modified conf/quads.yml
100644 → 100755
Empty file.
Empty file modified cron/quads
100644 → 100755
Empty file.
Empty file modified image/jenkins.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified image/quads-assignments.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified image/quads-calendar.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified image/quads-visual.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified image/quads-wiki.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified image/quads-workflow.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified image/quads.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/.DS_Store
Binary file not shown.
Empty file modified lib/__init__.py
100644 → 100755
Empty file.
Binary file added lib/hardware_services/.DS_Store
Binary file not shown.
Empty file modified lib/hardware_services/__init__.py
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ def load_data(self, quadsinstance, force):
exit(1)

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

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

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

Empty file modified lib/hardware_services/inventory_drivers/__init__.py
100644 → 100755
Empty file.
24 changes: 13 additions & 11 deletions lib/libquads.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,7 @@ def __init__(self, config, statedir, movecommand, datearg, syncstate, initialize
self.inventory_service = get_inventory_service()
self.network_service = get_network_service()

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

self.quads = QuadsData(self.data)
self._quads_history_init()
Expand All @@ -133,6 +125,10 @@ def _quads_history_init(self):

# we occasionally need to write the data back out
def quads_write_data(self, doexit = True):
self.inventory_service.write_data(self, doexit)


def quads_write_data_(self, doexit = True):
try:
stream = open(self.config, 'w')
self.data = {"clouds":self.quads.clouds.data, "hosts":self.quads.hosts.data, "history":self.quads.history.data}
Expand All @@ -143,10 +139,13 @@ def quads_write_data(self, doexit = True):
self.logger.error("There was a problem with your file %s" % ex)
if doexit:
exit(1)


def quads_init_data(self, force):
self.inventory_service.init_data(self, force)
# if passed --init, the config data is wiped.
# typically we will not want to continue execution if user asks to initialize
def quads_init_data(self, force):
def quads_init_data_(self, force):
if not force:
if os.path.isfile(self.config):
self.logger.warn("Warning: " + self.config + " exists. Use --force to initialize.")
Expand Down Expand Up @@ -200,9 +199,12 @@ def _quads_find_current(self, host, datearg):

else:
return None, None, None


# sync the statedir db for hosts with schedule
def quads_sync_state(self):
self.inventory_service.init_data(self)
# sync the statedir db for hosts with schedule
def quads_sync_state_(self):
# sync state
if self.datearg is not None:
self.logger.error("--sync and --date are mutually exclusive.")
Expand Down
Empty file modified templates/README.md
100644 → 100755
Empty file.
Empty file modified templates/foreman/foreman-post-configure-snippet.txt
100644 → 100755
Empty file.
Empty file modified testing/README.md
100644 → 100755
Empty file.
Empty file modified testing/test-quads.sh
100644 → 100755
Empty file.
Empty file modified testing/update-racks-page.md
100644 → 100755
Empty file.