From e794d8cb037f8fa9ccdd48ea3ad845fe9c56a416 Mon Sep 17 00:00:00 2001 From: Bernd Wachter Date: Mon, 11 Mar 2013 23:42:09 +0200 Subject: [PATCH] Fix accidental commit of rndssucli, add force option for update --- rndssucli/rndssucli.cpp | 20 +++++++++----------- rpm/ssu.changes | 3 +++ rpm/ssu.spec | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/rndssucli/rndssucli.cpp b/rndssucli/rndssucli.cpp index dfc5ee0..9edf19b 100644 --- a/rndssucli/rndssucli.cpp +++ b/rndssucli/rndssucli.cpp @@ -33,12 +33,7 @@ void RndSsuCli::run(){ QStringList arguments = QCoreApplication::arguments(); - if (arguments.count() >= 2){ - usage(); - return; - } - - if (arguments.at(1) == "register"){ + if (arguments.at(1) == "register" && arguments.count() == 2){ QString username, password; QTextStream qin(stdin); @@ -48,12 +43,16 @@ void RndSsuCli::run(){ password = qin.readLine(); ssu.sendRegistration(username, password); - } else if (arguments.at(1) == "update"){ + } else if (arguments.at(1) == "update" && + (arguments.count() == 2 || arguments.count() == 3)){ if (!ssu.isRegistered()){ qout << "Device is not registered, can't update credentials" << endl; QCoreApplication::exit(1); } else { - ssu.updateCredentials(); + bool force = false; + if (arguments.count() == 3 && arguments.at(2) == "-f") + force = true; + ssu.updateCredentials(force); } } else if (arguments.at(1) == "resolve"){ QString repo; @@ -67,12 +66,11 @@ void RndSsuCli::run(){ if (arguments.count() >= 3){ //qout << (arguments.at(3).compare("false")||arguments.at(3).compare("0")); qout << (arguments.at(3).compare("false")); - } qout << ssu.repoUrl(arguments.at(2)); QCoreApplication::exit(1); - } else if (arguments.at(1) == "status"){ + } else if (arguments.at(1) == "status" && arguments.count() == 2){ qout << "Device registration status: " << (ssu.isRegistered() ? "registered" : "not registered") << endl; qout << "Device family: " << ssu.deviceFamily() << endl; @@ -86,6 +84,6 @@ void RndSsuCli::run(){ void RndSsuCli::usage(){ QTextStream qout(stdout); - qout << "Usage: rndssu register|update|status" << endl; + qout << "Usage: rndssu register|update [-f]|status" << endl; QCoreApplication::exit(1); } diff --git a/rpm/ssu.changes b/rpm/ssu.changes index a97e1b0..bbcacba 100644 --- a/rpm/ssu.changes +++ b/rpm/ssu.changes @@ -1,3 +1,6 @@ +* Mon Mar 11 2013 Bernd Wachter - 0.23 +- Add force option to rndssu update + * Mon Mar 11 2013 Bernd Wachter - 0.22 - Add systemd logging to core library - Move zypper plugin logging to core library diff --git a/rpm/ssu.spec b/rpm/ssu.spec index d31a777..14878d5 100644 --- a/rpm/ssu.spec +++ b/rpm/ssu.spec @@ -1,5 +1,5 @@ Name: ssu -Version: 0.22 +Version: 0.23 Release: 1 Summary: SSU enabler for RND Group: System/Base