Martijn Koster created CLOUDSTACK-4556:
------------------------------------------

             Summary:  "12.10. Creating a Linux Template" sethostname script 
problems
                 Key: CLOUDSTACK-4556
                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-4556
             Project: CloudStack
          Issue Type: Bug
      Security Level: Public (Anyone can view this level - this is the default.)
          Components: Doc
    Affects Versions: 4.1.1
            Reporter: Martijn Koster


In the nightly build doc 
http://jenkins.cloudstack.org/view/master/job/build-docs-admin-master/lastSuccessfulBuild/artifact/Apache_CloudStack-4.2.0-Admin_Guide-en-US.pdf
section "12.10. Creating a Linux Template", there is a sethostname script, 
which has several issues:

The script appears to assume that it is called once, and that at that time the 
dhcp leases file has info in it.
What I've seen happen is that the first time it is invoked, the leases file is 
empty, and the script then destroys
/etc/hosts and /etc/hostname because it does no checking, and the second time 
when the leases file has the required info, the hostname is no longer 
"localhost", so the script is skipped. And this approach is strange anyway: the 
script goes through effort to extract values from the leases file, but it 
doesn't need to -- they are passed in by dhclient.

It calls "dpkg-reconfig" on 
https://github.com/apache/cloudstack/blob/922ef76224d4a8534f67f47b97cf664e5c65ecba/docs/en-US/prepare-linux-template.xml#L104,
 which should be "dpkg-reconfigure" on my ubuntu 12.04 instance:

{noformat}
root@test3:~# which dpkg-reconfig
root@test3:~# which dpkg-reconfigure
/usr/sbin/dpkg-reconfigure
root@test3:~# uname -a
Linux test3 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 
2013 x86_64 x86_64 x86_64 GNU/Linux
{noformat}

It would also be nice to set DEBIAN_FRONTEND=noninteractive such that 
dpkg-reconfigure doesn't cause debconf frontend warnings in the log.


In 
https://github.com/apache/cloudstack/blob/922ef76224d4a8534f67f47b97cf664e5c65ecba/docs/en-US/prepare-linux-template.xml#L108
 it sets user/group execute permissions for the script, but that is not 
required. dhclient-script(8) documents "invoked using the ´.´ command", and the 
other scripts in the /etc/dhcp/dhclient-exit-hooks.d/ directory have mode 644.

I'm working on an alternative in https://gist.github.com/makuk66/6379642, which 
appears to work but could do with some more testing.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to