This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from YoLoveLife/devel
DB complete
- Loading branch information
Showing
5 changed files
with
21 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,28 +5,28 @@ | |
# Email [email protected] | ||
from execute.service import AnsibleService | ||
from execute.callback.catch.basic import BasicResultCallback | ||
from execute.models import Callback | ||
from inventory.maker import Maker | ||
__metaclass__ = type | ||
class DBAnsibleService(AnsibleService): | ||
def __init__(self,hostlist): | ||
self.maker = Maker() | ||
self.hostlist = hostlist | ||
self.maker.inventory_maker(hostlist) | ||
super(DBAnsibleService,self).__init__(self.maker.filename) | ||
|
||
def run(self,hostlist,tasklist): | ||
def run(self,db,tasklist): | ||
callback = BasicResultCallback() | ||
self.push_callback(callback) | ||
|
||
super(DBAnsibleService,self).run(tasklist,self.maker) | ||
|
||
list = callback.ResultExtract() | ||
self.update(list,hostlist) | ||
self.update(list,db) | ||
|
||
def update(self,list,hostlist): | ||
for host in hostlist: | ||
host.coreness = list[0] | ||
host.memory = list[1] | ||
host.root_disk = list[2] | ||
host.hostname = list[3] | ||
host.save() | ||
def update(self,list,db): | ||
detail = db.dbdetail.get() | ||
detail.com_insert = list[0].strip() | ||
detail.com_update = list[1].strip() | ||
detail.max_connections = list[2].strip() | ||
detail.thread_running = list[3].strip() | ||
detail.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters