Script /usr/share/doc/capomastro/addsuperuser is not using its input variables

Bug #1419714 reported by Caio Begotti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Capomastro
Fix Released
High
Caio Begotti

Bug Description

The script /usr/share/doc/capomastro/addsuperuser shipped with the Capomastro package (and used by its Juju charm) seems not to be using its input variables correctly. They are passed ok, parsed ok, but yet they are not used apparently. I would need to investigate it further to check why this is a problem now, as I remember having tested it before we started using a Mojo spec, so I am not sure if this is a new problem or what. It might well be a problem with the default values of the variables, using ${:=default}.

This affect all Capomastro deployments using the "superuser", "superemail" and "superpassword" in the Juju charm to specify Django's superuser.

Caio Begotti (caio1982)
Changed in capomastro:
importance: Undecided → High
Daniel Manrique (roadmr)
Changed in capomastro:
milestone: none → 2015-04
Revision history for this message
Daniel Manrique (roadmr) wrote :

I tried the script manually and naively and it works OK.

In order to debug the script we could set it to use bash -x as the interpreter, and remove the redirections to /dev/null from the line that does all the work, because as-is, it looks fine to me and I have no idea why it could be failing, short of the charm calling it incorrectly. The syntax to assign the default values is OK, though I've more traditionally seen ${:-default}; there is a subtle difference but I don't think it would affect in this case:

       ${parameter:-word}
              Use Default Values. If parameter is unset or null, the expan‐
              sion of word is substituted. Otherwise, the value of parameter
              is substituted.
       ${parameter:=word}
              Assign Default Values. If parameter is unset or null, the
              expansion of word is assigned to parameter. The value of param‐
              eter is then substituted. Positional parameters and special
              parameters may not be assigned to in this way.

With the second syntax, $username will be assigned the default value (so after this line, $username="capomastro"). With the first syntax, the given variable is not modified, so $username="", despite the fact that "capomastro" will be substituted when running the line.

But since then the script ends, there should be no operational difference between the options.

I'll set this to confirmed based on Caio's observations.

Changed in capomastro:
status: New → Confirmed
Caio Begotti (caio1982)
Changed in capomastro:
assignee: nobody → Caio Begotti (caio1982)
Revision history for this message
Caio Begotti (caio1982) wrote :

This has been indirectly solved when we replaced this script with a real Django auth command in package 20150318 and charm revision 62.

Changed in capomastro:
status: Confirmed → Fix Committed
Daniel Manrique (roadmr)
Changed in capomastro:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.