Bug 42060 - App Center Self Service: Dev-Tools
App Center Self Service: Dev-Tools
Status: CLOSED DUPLICATE of bug 42917
Product: UCS
Classification: Unclassified
Component: App Center - Self Service
UCS 4.1
Other Linux
: P5 normal (vote)
: ---
Assigned To: Dirk Wiesenthal
Felix Botner
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-19 11:29 CEST by Felix Botner
Modified: 2017-11-16 14:24 CET (History)
0 users

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Botner univentionstaff 2016-08-19 11:29:24 CEST
(In reply to Dirk Wiesenthal from comment #9)
> You are right, there needs to be a Non-UCS-script at some point in time.
> 
> I thought it would be good if first, the functionality is checked. In a
> second step I would create a separate script.
> 
> Anyway, now the script is here:
>  
> https://selfservice.software-univention.de/appcenter-selfservice/univention-
> appcenter-selfservice
> 
> It is Python (because I really do not want to do argument parsing, response
> parsing, error messages in bash). And it is somehow based on univention-app.
> This does all the argparse / subparser stuff for me plus some subprocessing
> and logging.
> 
> Also, I tested all of it with univention-app.
> 
> As it had to be UCS independent, I copied _a lot_ of code from
> univention-appcenter, making the script ~600 lines long.



This new script is in which source package?

Is this the correct way to run the script?
-> curl -sSlf https://selfservice.software-univention.de/appcenter-selfservice/univention-appcenter-selfservice| python - status --username fbotner --pwdfile /tmp/a dudle

Is the download action broken?
-> curl -sSlf https://selfservice.software-univention.de/appcenter-selfservice/univention-appcenter-selfservice| python - download --username fbotner --pwdfile /tmp/a 4.1 dudle
Curling https://selfservice.software-univention.de/univention-management-console/auth
Curling https://selfservice.software-univention.de/univention-management-console/command/appcenter-selfservice/api
Curling https://selfservice.software-univention.de/univention-management-console/command/appcenter-selfservice/download_archive
Unrecoverable result: {u'status': 422, u'message': u'Eine Option f\xfcr download_archive hat den falschen Typ: 1 Fehler aufgetreten', u'result': {u'app': u'Component dudle does not exist'}}
Comment 1 Dirk Wiesenthal univentionstaff 2016-08-19 11:31:46 CEST
Currently, this is not Part of any package. I can copy it to self-service.

Download works on component_ids not app_ids.
Comment 2 Felix Botner univentionstaff 2016-08-19 11:52:40 CEST
(In reply to Dirk Wiesenthal from comment #1)
> Currently, this is not Part of any package. I can copy it to self-service.

yes

> Download works on component_ids not app_ids.

ah, ok

please add a action to contact univention
Comment 3 Felix Botner univentionstaff 2016-08-19 11:56:39 CEST
curl -sSfL https://selfservice.software-univention.de/appcenter-selfservice/univention-appcenter-selfservice
+ python - -h --username=fbotner --pwdfile /home/fbotner/.selfservicepwd
usage: -

- is a program to use the Univention App Center Self Service

help message looks a bit weired, i guess this "usage = '%(prog)s'" does not work if the script comes from stdin
Comment 4 Dirk Wiesenthal univentionstaff 2016-08-19 12:07:56 CEST
Piping it via curl is not the way I had in mind.

You can download it somewhere and use it multiple times (as you may want to add a new Version, upload something, contact Univention. 

There is a Check whether the script is up to date when being used. The Client compares its API_VERSION with one fetched from the server.
Comment 5 Felix Botner univentionstaff 2016-08-19 12:28:12 CEST
very cool, i think this script helps a lot

maybe we need something like update_latest_test_app, or get_latest_test_component, otherwise one has to figure out the name of the component before updating the test app (selfservice status horde, grep output to get component name, selfservice upload 4.1 horde_20160819115028 horde_20160819115028.tar.gz)

(In reply to Dirk Wiesenthal from comment #4)
> Piping it via curl is not the way I had in mind.

why not, i like that

> 
> You can download it somewhere and use it multiple times (as you may want to
> add a new Version, upload something, contact Univention. 
> 
> There is a Check whether the script is up to date when being used. The
> Client compares its API_VERSION with one fetched from the server.
Comment 6 Felix Botner univentionstaff 2016-08-19 12:29:46 CEST
Help message:
 upload              Uploads an App to the Univention Test App Center


Shouldn't that say "Uploads an App to the App Center Self Service"
Comment 7 Felix Botner univentionstaff 2016-08-19 12:44:16 CEST
please add something like 

 update-packages version component - Uploads packages to an App ...
Comment 8 Felix Botner univentionstaff 2016-08-19 13:47:21 CEST
if i run the script on dimma, i get the following error

 python /tmp/sl status horde
+ python /tmp/sl status horde
Traceback (most recent call last):
  File "/tmp/sl", line 152, in <module>
    class UniventionAppAction(object):
  File "/tmp/sl", line 155, in UniventionAppAction
    parent_logger = get_base_logger().getChild('actions')
AttributeError: Logger instance has no attribute 'getChild'
Comment 9 Felix Botner univentionstaff 2016-08-19 13:53:43 CEST
(In reply to Felix Botner from comment #8)
> if i run the script on dimma, i get the following error
> 
>  python /tmp/sl status horde
> + python /tmp/sl status horde
> Traceback (most recent call last):
>   File "/tmp/sl", line 152, in <module>
>     class UniventionAppAction(object):
>   File "/tmp/sl", line 155, in UniventionAppAction
>     parent_logger = get_base_logger().getChild('actions')
> AttributeError: Logger instance has no attribute 'getChild'

Do we really need this logger stuff in the self service script? Logging is done on the server (at least i hope so) and on the client it is enough to print error to stderr.
Comment 10 Dirk Wiesenthal univentionstaff 2016-09-02 13:12:26 CEST
(In reply to Felix Botner from comment #2)
> (In reply to Dirk Wiesenthal from comment #1)
> > Currently, this is not Part of any package. I can copy it to self-service.
> 
> yes
> 

Done

> > Download works on component_ids not app_ids.
> 
> ah, ok
> 
> please add a action to contact univention

I have not done this yet. Is this really needed for the script? This is basically writing a mail to appcenter@univention.de. Contacting Univention (especially that we shall publish the App) should be done after manual testing.

(In reply to Felix Botner from comment #3)
> curl -sSfL
> https://selfservice.software-univention.de/appcenter-selfservice/univention-
> appcenter-selfservice
> + python - -h --username=fbotner --pwdfile /home/fbotner/.selfservicepwd
> usage: -
> 
> - is a program to use the Univention App Center Self Service
> 
> help message looks a bit weired, i guess this "usage = '%(prog)s'" does not
> work if the script comes from stdin

Okay, done (I think)

(In reply to Felix Botner from comment #6)
> Help message:
>  upload              Uploads an App to the Univention Test App Center
> 
> 
> Shouldn't that say "Uploads an App to the App Center Self Service"

Okay, done

(In reply to Felix Botner from comment #7)
> please add something like 
> 
>  update-packages version component - Uploads packages to an App ...

This is %(prog)s upload *.deb

(In reply to Felix Botner from comment #8)
> if i run the script on dimma, i get the following error
> 
>  python /tmp/sl status horde
> + python /tmp/sl status horde
> Traceback (most recent call last):
>   File "/tmp/sl", line 152, in <module>
>     class UniventionAppAction(object):
>   File "/tmp/sl", line 155, in UniventionAppAction
>     parent_logger = get_base_logger().getChild('actions')
> AttributeError: Logger instance has no attribute 'getChild'

This is because you piped it. dimma has python2.6 installed while the script shebangs to python2.7. I do not know how many ISVs will use an outdated Python version AND pipe the script. The logging is not super important, but some features would need to be dropped / implemented. (e.g. red warning messages). But anyway, I cannot guarantee to stay python2.6 compatible after this workaround.

TODO:
Get latest component ID. Would you call this a blocker? Currently there is no such method on the server side. I would have to "grep" the component in the script (while still fetching everything!) or add this method to UMC just for this script.
Comment 11 Felix Botner univentionstaff 2016-09-05 15:43:15 CEST
(In reply to Dirk Wiesenthal from comment #10)
> I have not done this yet. Is this really needed for the script? This is
> basically writing a mail to appcenter@univention.de. Contacting Univention
> (especially that we shall publish the App) should be done after manual
> testing.

Some ISV's have scripts to test the app and sending an email to the appcenter. It would be nice to have such a feature in the selfservice script because then one don't need to setup the email infrastructure on the test system for sending this email and we are sure that the From address is correct (because it is set in the selfservice module).

-> but not important

>> AttributeError: Logger instance has no attribute 'getChild'
> This is because you piped it. 

No, this is because python2.6

> dimma has python2.6 installed while the script
> shebangs to python2.7. I do not know how many ISVs will use an outdated
> Python version AND pipe the script. 

i know at least one, Univention

> The logging is not super important, but
> some features would need to be dropped / implemented. (e.g. red warning
> messages). But anyway, I cannot guarantee to stay python2.6 compatible after
> this workaround.

Lets say i want to change packages for an app. I build the packages on the buildsystem and want to directly upload them to the selfservice. At the moment i have to copy the package to another system, a system that supports univention-appcenter-selfservice. But OK, i see the point, we can't support all python versions.

-> But at least check sys.version_info and abort the execution with an 
   appropriate error message if the script is executed with the wrong python 
   version.
Comment 12 Dirk Wiesenthal univentionstaff 2016-11-17 23:55:49 CET

*** This bug has been marked as a duplicate of bug 42917 ***
Comment 13 Felix Botner univentionstaff 2016-11-22 10:13:03 CET
(In reply to Dirk Wiesenthal from comment #12)
> 
> *** This bug has been marked as a duplicate of bug 42917 ***

hmm, ok then
Comment 14 Dirk Wiesenthal univentionstaff 2017-11-16 14:24:01 CET
Nothing to release