in lex/__init__.py [0:0]
def update_alias(self, bot, **kwargs):
alias = kwargs.get('Alias', 'LATEST')
print 'Updating alias {} for bot {}:{}' \
.format(alias, bot['name'], bot['version'])
current_bot = self.get_alias(bot['name'], alias)
resp = {}
if current_bot:
print 'Alias exists . . . updating.'
print 'name={}, version={}, checksum={}' \
.format(alias,
current_bot['botVersion'],
current_bot['checksum'])
resp = self.client.put_bot_alias(
checksum=current_bot['checksum'],
name=alias,
botName=current_bot['botName'],
botVersion=current_bot['botVersion']
)
else:
print 'Alias does NOT exist . . . creating.'
try:
resp = self.client.put_bot_alias(
name=alias,
botName=bot['name'],
botVersion=bot['version']
)
except Exception as e:
pprint.pprint(e)
print "Error creating bot: {}".format(resp)
print 'Alias updated'