Bug 668 - tl-setup should have an unattended mode
Summary: tl-setup should have an unattended mode
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Server Installer (show other bugs)
Version: trunk
Hardware: PC Linux
: P2 Enhancement
Target Milestone: 4.4.0
Assignee: Karl Mikaelsson
URL:
Keywords: hean01_tester, relnotes
Depends on:
Blocks: 5391 5388
  Show dependency treegraph
 
Reported: 2004-06-30 16:43 CEST by Erik Forsberg
Modified: 2015-04-27 09:49 CEST (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments

Description Erik Forsberg cendio 2004-06-30 16:43:15 CEST
The installation program should be able to read answers to all questions it will
ask from a file.

This would be of use in at least the following cases:

* People that want to install a large number of vsmagents in a automated way
could use it.

* We could use it internally for testing, to install and run a ThinLinc server
after each nightly build.
Comment 1 Erik Forsberg cendio 2004-06-30 16:44:05 CEST
Åstrand proposes the name "KickLinc" :-)
Comment 4 Peter Åstrand cendio 2014-01-08 13:35:49 CET
Incomplete list of things that needs to be done manually if skipping tl-setup:

* Create symlink:
# ln -sf sshd /etc/pam.d/thinlinc

* Create symlink to suitable Python binary
# ln -sf python /usr/bin/python-thinlinc 

* Create symlink:
# ln -sf /opt/thinlinc/libexec/thinlinc-login /usr/bin/thinlinc-login 

* Make sure dependency packages are installed, that a SSH daemon is running, and that suitable ports in the firewall are open. 

* If special printer queues are to be used, create them by running: 
# /opt/thinlinc/libexec/add_thinlocal_printer.sh
# /opt/thinlinc/libexec/add_nearest_printer.sh

* If using SELinux, run.
# /opt/thinlinc/share/selinux/install.

* Start services at boot:
# /opt/thinlinc/libexec/install_service vsmserver 99 10
# /opt/thinlinc/libexec/install_service vsmagent 98 10
# /opt/thinlinc/libexec/install_service tlwebadm 99 10

* Set admin email:
# tl-config /vsmserver/admin_email=myemail@myorganisation

* Set password for the web interface:
# tl-config /tlwebadm/password=`/opt/thinlinc/sbin/tl-gen-auth mypassword`


If tlclient.cgi is to be used:

* Make sure that web server with TLS support is installed

* Set ownership of /var/log/tlclient.cgi.log to the user running the web server

* For Apache, copy /opt/thinlinc/share/browser_client/thinlinc.conf to the httpd conf.d 
 directory, typically located below /etc. 


Finally:

* Indicate that the configuration is finished:
# read thinlinc version < /opt/thinlinc/etc/thinlinc-release
# /opt/thinlinc/bin/tl-config /vsm/setup_completed=${version}
Comment 5 Peter Åstrand cendio 2014-05-20 09:04:12 CEST
The Sun Ray "utsetup" can apparently be automated with a response file.
Comment 6 Karl Mikaelsson cendio 2014-12-16 09:57:10 CET
While an automated text-mode setup looks fairly straight-forward, having an automated PyGTK-based setup will be much harder unless we solve bug 4232 to separate the questions from the actions.
Comment 7 Karl Mikaelsson cendio 2015-01-30 09:37:47 CET
Committed as r29868-r29878.
Comment 8 Pierre Ossman cendio 2015-02-26 09:36:32 CET
Even without arguments you get a bunch of these in the log:

> 2015-02-26 09:30:07,347: No answer given for key accept-eula.
> 2015-02-26 09:30:08,527: No answer given for key server-type.

Is that really necessary?
Comment 9 Karl Mikaelsson cendio 2015-02-27 11:07:49 CET
(In reply to comment #8)
> Even without arguments you get a bunch of these in the log:
> 
> > 2015-02-26 09:30:07,347: No answer given for key accept-eula.
> > 2015-02-26 09:30:08,527: No answer given for key server-type.
> 
> Is that really necessary?

Fixed in r30059.
Comment 10 Henrik Andersson cendio 2015-03-31 12:24:40 CEST
When running using -g option without argument i get following output:

  [root@dhcp-253-34 conf.d]# tl-setup -g
  Usage: tl-setup [options]

  tl-setup: error: -g option requires an argument


  You can restart this wizard by running "ThinLinc Setup" from the menu,
  or executing /opt/thinlinc/sbin/tl-setup.

The two last lines does not belong here...
Comment 11 Henrik Andersson cendio 2015-03-31 14:18:46 CEST
After thoroughly testing here are the summarized issues I found:

- Errors such as "ERROR: No answer given for.." is written to stdout
  instead of stderr

- Default behavior when running tl-setup with answer file that has a
  missing config key is to "interactivly" ask. This seems wrong when
  this "interactive" mode is not wanted when its used for automated
  deployment (puppet etc). The default should be abort so the error
  can get caught by the non-interactive executor...

- Choosing 'no' as answer for installation of essentials is ignored
  and wizard will continue installation of essential packages such
  as xauth in my case.

- Running tl-setup -a non-existing-file will give following trace:

    ERROR:root:Traceback (most recent call last):
    ERROR:root:  File "/opt/thinlinc/sbin/../libexec/tl-setup.py", line 572, in <module>
    ERROR:root:    ooO0OO ( )
    ERROR:root:  File "/opt/thinlinc/sbin/../libexec/tl-setup.py", line 391, in ooO0OO
    ERROR:root:    tlsetup . parse_answers_file ( OOoOO0o0o0 . answers_file )
    ERROR:root:  File "/opt/thinlinc/modules/thinlinc/tlsetup/__init__.py", line 67, in parse_answers_file
    ERROR:root:    for O0OoOoo00o in iiIIIIi1i1 . get_parameters ( '/' ) :
    ERROR:root:AttributeError: 'NoneType' object has no attribute 'get_parameters'

- tl-setup -g existing-file, will blindly overwrite existing
  configuration file. Should probably ask user if overwrite or
  merge new "questions" available into existing file.
Comment 12 Henrik Andersson cendio 2015-03-31 14:22:18 CEST
(In reply to comment #10)
> When running using -g option without argument i get following output:
> 
>   [root@dhcp-253-34 conf.d]# tl-setup -g
>   Usage: tl-setup [options]
> 
>   tl-setup: error: -g option requires an argument
> 
> 
>   You can restart this wizard by running "ThinLinc Setup" from the menu,
>   or executing /opt/thinlinc/sbin/tl-setup.
> 
> The two last lines does not belong here...

This seems to apply to all exit codes which is not 0

  >> Using answer accept-eula=no from answer file

  You can restart this wizard by running "ThinLinc Setup" from the menu,
  or executing /opt/thinlinc/sbin/tl-setup.
Comment 13 Henrik Andersson cendio 2015-04-09 15:33:01 CEST
Apparmor was forgotten in commit r29874 which adds use of answers.
Comment 14 Henrik Andersson cendio 2015-04-10 07:58:30 CEST
(In reply to comment #13)
> Apparmor was forgotten in commit r29874 which adds use of answers.

Fixed in commit r30220.
Comment 15 Henrik Andersson cendio 2015-04-13 12:53:59 CEST
Update our internal Thinlinc puppet module to use a answer file for deploying ThinLinc. Works as expected tested using Ubuntu 14.04.
Comment 16 Karl Mikaelsson cendio 2015-04-15 13:58:21 CEST
(In reply to comment #11)
> After thoroughly testing here are the summarized issues I found:
> 
> - Errors such as "ERROR: No answer given for.." is written to stdout
>   instead of stderr

r30241.
 
> - Default behavior when running tl-setup with answer file that has a
>   missing config key is to "interactivly" ask. This seems wrong when
>   this "interactive" mode is not wanted when its used for automated
>   deployment (puppet etc). The default should be abort so the error
>   can get caught by the non-interactive executor...

As per discussions outside of Bugzilla, we'll leave this as-is for now.
 
> - Choosing 'no' as answer for installation of essentials is ignored
>   and wizard will continue installation of essential packages such
>   as xauth in my case.

r30243.

> - Running tl-setup -a non-existing-file will give following trace:
> 
>     ERROR:root:Traceback (most recent call last):
>     ERROR:root:  File "/opt/thinlinc/sbin/../libexec/tl-setup.py", line 572, in
> <module>
>     ERROR:root:    ooO0OO ( )
>     ERROR:root:  File "/opt/thinlinc/sbin/../libexec/tl-setup.py", line 391, in
> ooO0OO
>     ERROR:root:    tlsetup . parse_answers_file ( OOoOO0o0o0 . answers_file )
>     ERROR:root:  File "/opt/thinlinc/modules/thinlinc/tlsetup/__init__.py",
> line 67, in parse_answers_file
>     ERROR:root:    for O0OoOoo00o in iiIIIIi1i1 . get_parameters ( '/' ) :
>     ERROR:root:AttributeError: 'NoneType' object has no attribute
> 'get_parameters'

r30242.
 
> - tl-setup -g existing-file, will blindly overwrite existing
>   configuration file. Should probably ask user if overwrite or
>   merge new "questions" available into existing file.

I've discussed this with Henrik, won't take actions. If we could get tl-setup to spit out a new answer file after a successful run (bug 5391), merging would be as easy as run tl-setup with old file (with missing-answer=ask), answer new questions and get a new file.
Comment 17 Henrik Andersson cendio 2015-04-16 07:49:40 CEST
(In reply to comment #16)

Tested using server build 4726:

> (In reply to comment #11)
> > After thoroughly testing here are the summarized issues I found:
> > 
> > - Errors such as "ERROR: No answer given for.." is written to stdout
> >   instead of stderr
> 
> r30241.
>

Works as expected

> 
> > - Choosing 'no' as answer for installation of essentials is ignored
> >   and wizard will continue installation of essential packages such
> >   as xauth in my case.
> 
> r30243.
> 

Works as expected


> > - Running tl-setup -a non-existing-file will give following trace:
> > 
> >     ERROR:root:Traceback (most recent call last):
> >     ERROR:root:  File "/opt/thinlinc/sbin/../libexec/tl-setup.py", line 572, in
> > <module>
> >     ERROR:root:    ooO0OO ( )
> >     ERROR:root:  File "/opt/thinlinc/sbin/../libexec/tl-setup.py", line 391, in
> > ooO0OO
> >     ERROR:root:    tlsetup . parse_answers_file ( OOoOO0o0o0 . answers_file )
> >     ERROR:root:  File "/opt/thinlinc/modules/thinlinc/tlsetup/__init__.py",
> > line 67, in parse_answers_file
> >     ERROR:root:    for O0OoOoo00o in iiIIIIi1i1 . get_parameters ( '/' ) :
> >     ERROR:root:AttributeError: 'NoneType' object has no attribute
> > 'get_parameters'
> 
> r30242.
> 

Works as expected
Comment 18 Henrik Andersson cendio 2015-04-16 08:01:24 CEST
- Issue in comment #10 is still a problem.

- If runnning tl-setup with a template and only set answer
  for EULA to yes to get the process continue. The examples
  in template are used as answers.

     SELinux
     =======

     This system is using the SELinux access control system. A ThinLinc
     module needs to be loaded for ThinLinc to operate correctly in this
     environment. Would you like to compile and install the ThinLinc
     SELinux module?

     >> Using answer setup-selinux=yes|no from answer file

  It's not clear what the defaults are, maybe the template file should
  comment out the example answers in the template... In SELinux example
  the answer is not true and it will be skipped and for the email address
  the example email is used...
Comment 19 Karl Mikaelsson cendio 2015-04-16 09:53:59 CEST
(In reply to comment #18)
> - Issue in comment #10 is still a problem.

I'm leaning towards wontfix for this particular issue. I don't see it being harmful or incorrect, and removing it from a few edge cases seems like lots of work for small improvements.
 
> - If runnning tl-setup with a template and only set answer
>   for EULA to yes to get the process continue. The examples
>   in template are used as answers.
> 
>      SELinux
>      =======
> 
>      This system is using the SELinux access control system. A ThinLinc
>      module needs to be loaded for ThinLinc to operate correctly in this
>      environment. Would you like to compile and install the ThinLinc
>      SELinux module?
> 
>      >> Using answer setup-selinux=yes|no from answer file
> 
>   It's not clear what the defaults are, maybe the template file should
>   comment out the example answers in the template... In SELinux example
>   the answer is not true and it will be skipped and for the email address
>   the example email is used...

w.r.t. having these as comments, I've had the same thought myself, but it got lost somewhere along the way. Fixed in r30247.
Comment 20 Henrik Andersson cendio 2015-04-17 08:47:24 CEST
Retested using build 4727 and verified that automatic (puppet) and manual deployment using answer file works as expected.

Everything looks good, closing.
Comment 21 Henrik Andersson cendio 2015-04-23 12:53:26 CEST
tl-setup traceback while running on rhel5 which uses python-2.4.3-56.el5:

Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns: Traceback (most recent call last):
Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns:   File "/opt/thinlinc/sbin/../libexec/tl-setup.py", line 41, in ?
Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns:     from thinlinc import tlsetup
Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns:   File "/opt/thinlinc/modules/thinlinc/tlsetup/__init__.py", line 78
Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns:     with open ( f , 'w' ) as i1iIIi1 :
Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns:             ^
Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns: SyntaxError: invalid syntax
Comment 22 Karl Mikaelsson cendio 2015-04-24 13:35:41 CEST
(In reply to comment #21)
> tl-setup traceback while running on rhel5 which uses python-2.4.3-56.el5:
> 
> Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns: Traceback
> (most recent call last):
> Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns:   File
> "/opt/thinlinc/sbin/../libexec/tl-setup.py", line 41, in ?
> Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns:     from
> thinlinc import tlsetup
> Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns:   File
> "/opt/thinlinc/modules/thinlinc/tlsetup/__init__.py", line 78
> Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns:     with
> open ( f , 'w' ) as i1iIIi1 :
> Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns:            
> ^
> Notice: /Stage[main]/Thinlinc::Install/Exec[run-tl-setup]/returns: SyntaxError:
> invalid syntax

Fixed in r30263.

An autotest to warn about usage of these constructs was added in r30264, and thanks to these, I found that tl-notify was also using the same constructs. I fixed that issue in r30265.

The tester should make sure tl-notify still works.
Comment 23 Henrik Andersson cendio 2015-04-27 09:49:59 CEST
> 
> Fixed in r30263.
> 
> An autotest to warn about usage of these constructs was added in r30264, and
> thanks to these, I found that tl-notify was also using the same constructs. I
> fixed that issue in r30265.
> 
> The tester should make sure tl-notify still works.

Using build 4737 i verified both tl-setup and tl-notify functionality.

Closing.

Note You need to log in before you can comment on or make changes to this bug.