OLD | NEW |
1 # This file is part of the Juju Quickstart Plugin, which lets users set up a | 1 # This file is part of the Juju Quickstart Plugin, which lets users set up a |
2 # Juju environment in very few steps (https://launchpad.net/juju-quickstart). | 2 # Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
3 # Copyright (C) 2013-2014 Canonical Ltd. | 3 # Copyright (C) 2013-2014 Canonical Ltd. |
4 # | 4 # |
5 # This program is free software: you can redistribute it and/or modify it under | 5 # This program is free software: you can redistribute it and/or modify it under |
6 # the terms of the GNU Affero General Public License version 3, as published by | 6 # the terms of the GNU Affero General Public License version 3, as published by |
7 # the Free Software Foundation. | 7 # the Free Software Foundation. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, but WITHOUT | 9 # This program is distributed in the hope that it will be useful, but WITHOUT |
10 # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, | 10 # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 # required to bootstrap the application, even in newer Juju versions | 456 # required to bootstrap the application, even in newer Juju versions |
457 # where "sudo" is invoked by juju-core itself. | 457 # where "sudo" is invoked by juju-core itself. |
458 print('sudo privileges will be required to bootstrap the environment') | 458 print('sudo privileges will be required to bootstrap the environment') |
459 # If the Juju version is less than 1.17.2 then use sudo for local envs. | 459 # If the Juju version is less than 1.17.2 then use sudo for local envs. |
460 requires_sudo = juju_version < (1, 17, 2) | 460 requires_sudo = juju_version < (1, 17, 2) |
461 already_bootstrapped, bsn_series = app.bootstrap( | 461 already_bootstrapped, bsn_series = app.bootstrap( |
462 options.env_name, requires_sudo=requires_sudo, debug=options.debug) | 462 options.env_name, requires_sudo=requires_sudo, debug=options.debug) |
463 | 463 |
464 # Retrieve the admin-secret for the current environment. | 464 # Retrieve the admin-secret for the current environment. |
465 try: | 465 try: |
466 admin_secret = app.get_admin_secret( | 466 admin_secret = app.get_value_from_jenv( |
467 options.env_name, settings.JUJU_HOME) | 467 options.env_name, settings.JUJU_HOME, 'admin-secret') |
468 except ValueError as err: | 468 except ValueError as err: |
469 admin_secret = options.admin_secret | 469 admin_secret = options.admin_secret |
470 if admin_secret is None: | 470 if admin_secret is None: |
471 # The admin-secret cannot be found in the jenv file and is not | 471 # The admin-secret cannot be found in the jenv file and is not |
472 # explicitly specified in the environments.yaml file. | 472 # explicitly specified in the environments.yaml file. |
473 msg = b'{} or {}'.format(err, options.env_file.encode('utf-8')) | 473 msg = b'{} or {}'.format(err, options.env_file.encode('utf-8')) |
474 raise app.ProgramExit(msg) | 474 raise app.ProgramExit(msg) |
475 | 475 |
476 print('retrieving the Juju API address') | 476 print('retrieving the Juju API address') |
477 api_url = app.get_api_url(options.env_name) | 477 api_url = app.get_api_url(options.env_name) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 'to reopen and log in to the GUI browser later.\n' | 521 'to reopen and log in to the GUI browser later.\n' |
522 'Run "juju quickstart -i" if you want to manage\n' | 522 'Run "juju quickstart -i" if you want to manage\n' |
523 'or bootstrap your Juju environments using the\n' | 523 'or bootstrap your Juju environments using the\n' |
524 'interactive session.\n' | 524 'interactive session.\n' |
525 'Run "{sudo}juju destroy-environment {eflag}{env_name} [-y]"\n' | 525 'Run "{sudo}juju destroy-environment {eflag}{env_name} [-y]"\n' |
526 'to destroy the environment you just bootstrapped.'.format( | 526 'to destroy the environment you just bootstrapped.'.format( |
527 env_name=options.env_name, | 527 env_name=options.env_name, |
528 sudo='sudo ' if requires_sudo else '', | 528 sudo='sudo ' if requires_sudo else '', |
529 eflag='-e ' if juju_version < (1, 17, 2) else '') | 529 eflag='-e ' if juju_version < (1, 17, 2) else '') |
530 ) | 530 ) |
OLD | NEW |