Skip to content

Instantly share code, notes, and snippets.

@mzk-vct
Created February 2, 2017 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mzk-vct/89d2795c86771fe22ad0ead47b89f04a to your computer and use it in GitHub Desktop.
Save mzk-vct/89d2795c86771fe22ad0ead47b89f04a to your computer and use it in GitHub Desktop.
Script for creating schedule. Generates POOL_UPGRADE command that can be send useing CLI to cluster
# Script for creating schedule
# Generates POOL_UPGRADE command that can be send useing CLI to cluster
```from datetime import datetime, timedelta
from dateutil import tz
tempalte = "send POOL_UPGRADE name={name} version={version} sha256={sha256} " \
"action={action} schedule={schedule} timeout={timeout}"\
now = datetime.utcnow().replace(tzinfo=tz.tzutc()) + timedelta(minutes=5)
nodeIds = [
"Gw6pDLhcBcoQesN72qfotTgFa7cbuqZpkX3Xo6pLhPhv",
"8ECVSk179mjsjKRLWiQtssMLgp6EPhWXtaYyStWPSGAb",
"DKVxG2fXXTU8yT5N7hGEbXB3dfdAnYv1JczDUHpmDxya",
"4PS3EDQ3dW1tci1Bp6543CfuuebjFrg36kLAUcskGfaA",
"28QFrtVKbbmhJ8nWXsWfLApCi182JkKCMUy5KR4MCNQeCaAs3oVnU4ycFGp6uapcb4UC9RW57X9g2RoUhe95GtQg"
]
schedule = dict((nodeId, str(now + (timedelta(minutes=5) * i)))
for i, nodeId in enumerate(nodeIds))
command = tempalte.format(name="upgrade-11",
version="0.1",
sha256="aad1242",
action="start",
schedule=schedule,
timeout=10)
print(command)
exit()```
@mzk-vct
Copy link
Author

mzk-vct commented Feb 2, 2017

Please note that you need to specify own nodeIds, version and name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment