Skip to content

Commit

Permalink
Merge branch 'release/0.0.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
akatrevorjay committed Jan 26, 2016
2 parents 615f067 + 01a16a4 commit fca0004
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 24 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ Usage

### Restart

This currently requires Salt to restart the service after shutting it down.

```
Usage: rollastic restart [OPTIONS] MASTER_NODE
Expand All @@ -40,7 +38,7 @@ Usage: rollastic restart [OPTIONS] MASTER_NODE
If node's heap used percentage is over kill-at-heap:
* Disable cluster allocation
* Ping node through Salt to verify connectivity
* Shutdown node through ES API
* Shutdown node
* Wait for ES to die for 2m.
If it's not dead, run a killall java and wait another 2m.
If it's still not dead, fail.
Expand All @@ -59,8 +57,6 @@ Options:

### Upgrade

This works hand in hand with our fork of the elasticsearch Salt formula: https://github.com/vkgit/saltstack-elasticsearch-formula

```
Usage: rollastic upgrade [OPTIONS] MASTER_NODE
Expand All @@ -80,7 +76,7 @@ Usage: rollastic upgrade [OPTIONS] MASTER_NODE
* Ping node through Salt to verify connectivity
* Run a Salt highstate
* Check for an available upgrade on the Elasticsearch package, if so:
- Shutdown node through ES API
- Shutdown node
- Wait for ES to die for 2m.
If it's not dead, run a killall java and wait another 2m.
If it's still not dead, fail.
Expand Down
4 changes: 2 additions & 2 deletions rollastic/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def restart(master_node, kill_at_heap, masters, datas):
If node's heap used percentage is over kill-at-heap:
* Disable cluster allocation
* Ping node through Salt to verify connectivity
* Shutdown node through ES API
* Shutdown node
* Wait for ES to die for 2m.
If it's not dead, run a killall java and wait another 2m.
If it's still not dead, fail.
Expand Down Expand Up @@ -70,7 +70,7 @@ def upgrade(master_node, masters, datas, minimum_version):
* Ping node through Salt to verify connectivity
* Run a Salt highstate
* Check for an available upgrade on the Elasticsearch package, if so:
- Shutdown node through ES API
- Shutdown node
- Wait for ES to die for 2m.
If it's not dead, run a killall java and wait another 2m.
If it's still not dead, fail.
Expand Down
2 changes: 1 addition & 1 deletion rollastic/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.6'
__version__ = '0.0.7'
25 changes: 10 additions & 15 deletions rollastic/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,6 @@ def publish_host(self):
if v:
return v

def shutdown(self):
'''
Shutdown node through ES API
:return:
:rtype:
'''
_LOG.info('Shutting down node=%s through elasticsearch API', self)
assert self.name
ret = self.cluster.es.nodes.shutdown(self.name)
_LOG.debug(ret)
return ret


class NodeSaltOps(object):
'''
Expand Down Expand Up @@ -205,6 +192,15 @@ def service_start(self, name):
_LOG.info('Starting service=%s', name)
return bool(self.cmd('service.start', [name]))

def service_stop(self, name):
'''
:param str name: Service name
:return: Bool if service was stopped
:rtype: bool
'''
_LOG.info('Stopping service=%s', name)
return bool(self.cmd('service.stop', [name]))

def wait_for_service_status(self, name, status, check_every=10, timeout_iterations=6):
'''
Waits for service status with specified timeout.
Expand Down Expand Up @@ -246,8 +242,7 @@ def ensure_elasticsearch_is_dead(self, kill_on_shutdown_timeout=True):
:rtype: bool
'''
_LOG.info('Ensuring elasticsearch is dead on node=%s', self.node)

self.node.shutdown()
self.service_stop('elasticsearch')

# This will wait for up to one minute
dead = self.wait_for_service_status('elasticsearch', False)
Expand Down

0 comments on commit fca0004

Please sign in to comment.