Skip to content
Permalink
Browse files
[ssucli] Add option to set username for home during registration
  • Loading branch information
bwachter committed Aug 27, 2013
1 parent 58366a1 commit b2dca5a2f46a6d6db2db1524eb711631b910db82
Showing with 11 additions and 6 deletions.
  1. +10 −5 rndssucli/rndssucli.cpp
  2. +1 −1 rndssucli/rndssucli.h
@@ -181,14 +181,15 @@ void RndSsuCli::optModifyRepo(int action, QStringList opt){
}
}

void RndSsuCli::optRegister(){
void RndSsuCli::optRegister(QStringList opt){
/*
* register a new device
*/

QString username, password;
QTextStream qin(stdin);
QTextStream qout(stdout);
SsuCoreConfig *ssuSettings = SsuCoreConfig::instance();

struct termios termNew, termOld;

@@ -206,6 +207,9 @@ void RndSsuCli::optRegister(){

tcsetattr(STDIN_FILENO, TCSANOW, &termOld);

if (opt.count() == 3 && opt.at(2) == "-h")
ssuSettings->setValue("repository-url-variables/user", username);

ssu.sendRegistration(username, password);
state = Busy;
}
@@ -456,9 +460,7 @@ void RndSsuCli::run(){
// everything without additional arguments gets handled here
// functions with arguments need to take care of argument validation themselves
if (arguments.count() == 2){
if (arguments.at(1) == "register" || arguments.at(1) == "r")
optRegister();
else if (arguments.at(1) == "status" || arguments.at(1) == "s")
if (arguments.at(1) == "status" || arguments.at(1) == "s")
optStatus();
else if (arguments.at(1) == "updaterepos" || arguments.at(1) == "ur")
optUpdateRepos();
@@ -480,7 +482,9 @@ void RndSsuCli::run(){

// functions accepting 0 or more arguments; those need to set state to Idle
// on success
if (arguments.at(1) == "repos" || arguments.at(1) == "lr")
if (arguments.at(1) == "register" || arguments.at(1) == "r")
optRegister(arguments);
else if (arguments.at(1) == "repos" || arguments.at(1) == "lr")
optRepos(arguments);
else if (arguments.at(1) == "flavour" || arguments.at(1) == "fl")
optFlavour(arguments);
@@ -539,6 +543,7 @@ void RndSsuCli::usage(){
<< "Device management:" << endl
<< "\tstatus, s \tprint registration status and device information" << endl
<< "\tregister, r \tregister this device" << endl
<< "\t [-h] \tconfigure user for OBS home" << endl
<< "\tupdate, up \tupdate repository credentials" << endl
<< "\t [-f] \tforce update" << endl
<< "\tmodel, mo \tprint name of device model (like N9)" << endl
@@ -35,7 +35,7 @@ class RndSsuCli: public QObject {
void optMode(QStringList opt);
void optModel(QStringList opt);
void optModifyRepo(int action, QStringList opt);
void optRegister();
void optRegister(QStringList opt);
void optRelease(QStringList opt);
void optRepos(QStringList opt);
void optStatus();

0 comments on commit b2dca5a

Please sign in to comment.