Skip to content

Commit 248d52f

Browse files
authored
Merge pull request #2928 from StackStorm/2_0_1_patch_release
Additional changes for v2.0.1 release
2 parents 9e23136 + a31407a commit 248d52f

7 files changed

Lines changed: 28 additions & 12 deletions

File tree

CHANGELOG.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
Changelog
22
=========
33

4-
In development
5-
--------------
6-
7-
8-
2.0.1 - September 23, 2016
4+
2.0.1 - September 30, 2016
95
--------------------------
106

117
* Fix ``st2 execution get`` command so now ``--attr`` argument correctly works with child
@@ -19,6 +15,9 @@ In development
1915
the ``st2 trace list`` CLI command. (improvement)
2016
* Fix a bug with action default parameter values not supporting Jinja template
2117
notation for parameters of type ``object``. (bug fix, improvement)
18+
* Fix ``--user`` / ``-u`` argument in the ``st2 key delete`` CLI command.
19+
* Retry connecting to RabbitMQ on services start-up if connecting fails because
20+
of an intermediate network error or similar. (improvements)
2221

2322
2.0.0 - August 31, 2016
2423
-----------------------

st2client/st2client/commands/keyvalue.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ def run(self, args, **kwargs):
184184
scope = getattr(args, 'scope', DEFAULT_SCOPE)
185185
kwargs['params'] = {}
186186
kwargs['params']['scope'] = scope
187+
kwargs['params']['user'] = args.user
187188
instance = self.get_resource(resource_id, **kwargs)
188189

189190
if not instance:

st2common/st2common/config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ def register_opts(ignore_errors=False):
129129
cfg.StrOpt('url', default='amqp://guest:guest@127.0.0.1:5672//',
130130
help='URL of the messaging server.'),
131131
cfg.ListOpt('cluster_urls', default=[],
132-
help='URL of all the nodes in a messaging service cluster.')
132+
help='URL of all the nodes in a messaging service cluster.'),
133+
cfg.IntOpt('connection_retries', default=10,
134+
help='How many times should we retry connection before failing.'),
135+
cfg.IntOpt('connection_retry_wait', default=10000,
136+
help='How long should we wait between connection retries.')
133137
]
134138
do_register_opts(messaging_opts, 'messaging', ignore_errors)
135139

st2common/st2common/script_setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from st2common.service_setup import db_setup
3131
from st2common.service_setup import db_teardown
3232
from st2common.logging.filters import LogLevelFilter
33-
from st2common.transport.bootstrap_utils import register_exchanges
33+
from st2common.transport.bootstrap_utils import register_exchanges_with_retry
3434

3535
__all__ = [
3636
'setup',
@@ -86,7 +86,7 @@ def setup(config, setup_db=True, register_mq_exchanges=True):
8686
db_setup()
8787

8888
if register_mq_exchanges:
89-
register_exchanges()
89+
register_exchanges_with_retry()
9090

9191

9292
def teardown():

st2common/st2common/service_setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from st2common.models import db
2828
from st2common.constants.logging import DEFAULT_LOGGING_CONF_PATH
2929
from st2common.persistence import db_init
30-
from st2common.transport.bootstrap_utils import register_exchanges
30+
from st2common.transport.bootstrap_utils import register_exchanges_with_retry
3131
from st2common.signal_handlers import register_common_signal_handlers
3232
from st2common.util.debugging import enable_debugging
3333
from st2common.models.utils.profiling import enable_profiling
@@ -99,7 +99,7 @@ def setup(service, config, setup_db=True, register_mq_exchanges=True,
9999
db_setup()
100100

101101
if register_mq_exchanges:
102-
register_exchanges()
102+
register_exchanges_with_retry()
103103

104104
if register_signal_handlers:
105105
register_common_signal_handlers()

st2common/st2common/transport/bootstrap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import logging
1717
import st2common.config as config
1818

19-
from st2common.transport.bootstrap_utils import register_exchanges
19+
from st2common.transport.bootstrap_utils import register_exchanges_with_retry
2020

2121

2222
def _setup():
@@ -29,7 +29,7 @@ def _setup():
2929

3030
def main():
3131
_setup()
32-
register_exchanges()
32+
register_exchanges_with_retry()
3333

3434

3535
# The scripts sets up Exchanges in RabbitMQ.

st2common/st2common/transport/bootstrap_utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
import retrying
17+
import socket
18+
from oslo_config import cfg
1619
from kombu import Connection
1720
from st2common import log as logging
1821
from st2common.transport import utils as transport_utils
@@ -69,3 +72,12 @@ def wrapped_register_exchanges(connection, channel):
6972
retry_wrapper=retry_wrapper)
7073

7174
retry_wrapper.run(connection=conn, wrapped_callback=wrapped_register_exchanges)
75+
76+
77+
def register_exchanges_with_retry():
78+
retrying_obj = retrying.Retrying(
79+
retry_on_exception=socket.error,
80+
wait_fixed=cfg.CONF.messaging.connection_retry_wait,
81+
stop_max_attempt_number=cfg.CONF.messaging.connection_retries
82+
)
83+
return retrying_obj.call(register_exchanges)

0 commit comments

Comments
 (0)