Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ssucli] Add option to set username for home during registration
  • Loading branch information
Bernd Wachter committed Aug 27, 2013
1 parent 58366a1 commit b2dca5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions rndssucli/rndssucli.cpp
Expand Up @@ -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;

Expand All @@ -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;
}
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rndssucli/rndssucli.h
Expand Up @@ -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();
Expand Down

0 comments on commit b2dca5a

Please sign in to comment.