| 575 | |
| 576 | @contextlib.contextmanager |
| 577 | def pull_image(ctx, config): |
| 578 | cluster_name = config['cluster'] |
| 579 | log.info(f'Pulling image {ctx.ceph[cluster_name].image} on all hosts...') |
| 580 | cmd = [ |
| 581 | 'sudo', |
| 582 | ctx.cephadm, |
| 583 | '--image', |
| 584 | ctx.ceph[cluster_name].image, |
| 585 | 'pull', |
| 586 | ] |
| 587 | if config.get('registry-login'): |
| 588 | registry = config['registry-login'] |
| 589 | login_cmd = [ |
| 590 | 'sudo', |
| 591 | ctx.cephadm, |
| 592 | 'registry-login', |
| 593 | '--registry-url', registry['url'], |
| 594 | '--registry-username', registry['username'], |
| 595 | '--registry-password', registry['password'], |
| 596 | ] |
| 597 | cmd = login_cmd + [run.Raw('&&')] + cmd |
| 598 | run.wait(ctx.cluster.run(args=cmd, wait=False)) |
| 599 | |
| 600 | try: |
| 601 | yield |
| 602 | finally: |
| 603 | pass |
| 604 | |
| 605 | |
| 606 | @contextlib.contextmanager |