Revision 24684bbb
b/image_creator/dialog_main.py | ||
---|---|---|
366 | 366 |
d = session['dialog'] |
367 | 367 |
default_item = "Account" |
368 | 368 |
|
369 |
(session['account'], session['token']) = Kamaki.saved_credentials() |
|
369 |
account = Kamaki.get_account() |
|
370 |
if account: |
|
371 |
session['account'] = account |
|
372 |
|
|
373 |
token = Kamaki.get_token() |
|
374 |
if token: |
|
375 |
session['token'] = token |
|
376 |
|
|
370 | 377 |
while 1: |
371 | 378 |
account = session["account"] if "account" in session else "<none>" |
372 | 379 |
token = session["token"] if "token" in session else "<none>" |
... | ... | |
782 | 789 |
while 1: |
783 | 790 |
if media is not None: |
784 | 791 |
if not os.path.exists(media): |
785 |
d.msgbox("The file you choose does not exist",
|
|
792 |
d.msgbox("The file `%s' you choose does not exist." % media,
|
|
786 | 793 |
width=MSGBOX_WIDTH) |
787 | 794 |
else: |
788 | 795 |
break |
... | ... | |
812 | 819 |
d.setBackgroundTitle('snf-image-creator') |
813 | 820 |
|
814 | 821 |
if os.geteuid() != 0: |
815 |
raise FatalError("You must run %s as root" % basename)
|
|
822 |
raise FatalError("You must run %s as root" % parser.get_prog_name())
|
|
816 | 823 |
|
817 | 824 |
media = select_file(d, args[0] if len(args) == 1 else None) |
818 | 825 |
|
... | ... | |
873 | 880 |
main_menu(session) |
874 | 881 |
break |
875 | 882 |
|
876 |
exit_msg = "You have not selected if you want to run " \ |
|
877 |
"snf-image-creator in wizard or expert mode." |
|
878 |
if confirm_exit(d, exit_msg): |
|
883 |
if confirm_exit(d): |
|
879 | 884 |
break |
880 | 885 |
|
881 | 886 |
d.infobox("Thank you for using snf-image-creator. Bye", width=53) |
b/image_creator/kamaki_wrapper.py | ||
---|---|---|
46 | 46 |
class Kamaki(object): |
47 | 47 |
|
48 | 48 |
@staticmethod |
49 |
def saved_credentials():
|
|
49 |
def get_account():
|
|
50 | 50 |
config = Config() |
51 |
account = config.get('storage', 'account') |
|
52 |
token = config.get('global', 'token') |
|
51 |
return config.get('storage', 'account') |
|
53 | 52 |
|
54 |
return (account, token) |
|
53 |
@staticmethod |
|
54 |
def get_token(): |
|
55 |
config = Config() |
|
56 |
return config.get('global', 'token') |
|
55 | 57 |
|
56 | 58 |
@staticmethod |
57 | 59 |
def save_account(account): |
Also available in: Unified diff