summaryrefslogtreecommitdiff
path: root/heat/cloudinit/loguserdata.py
Commit message (Collapse)AuthorAgeFilesLines
* Detect EL8 platform-pythonLuke Short2021-08-181-0/+9
| | | | | | | | Otherwise, this script fails to run on Enterprise Linux 8 distros. Change-Id: I0168b380d0e201d9c8f8121b384d25a2412c2129 Signed-off-by: Luke Short <ekultails@gmail.com> (cherry picked from commit 2d692e22f42bc64476ab01ff7e8c4d4717ef3786)
* Validate that python3 is ready for loguserdataVitaly Gridnev2016-08-261-1/+5
| | | | | | | | | | | | By default, ubuntu trusty images has python3 executable in path, but we can't use that for executing loguserdata script, because pkg_resources can't be imported. Now it's proposed to try importing pkg_resources for validating readiness of python3 for executing this script. If pkg_resources can't be imported there is no other choice except using python2. Change-Id: Icb4f58630016874eb40dd77590469fc5de6287e4 Closes-bug: 1617069
* Use Fedora 24 base imageThomas Herve2016-07-121-1/+9
| | | | | | | Use the standard base image for now, it's smaller and we don't need the full custom image. Change-Id: Ifaccf340f0ff4eac52b1eeef5914b7e90f2687da
* Optimize "open" method with context managerxiexs2015-11-271-4/+1
| | | | | | Use opening context manager to open a file. Change-Id: I07ea2f163b101e9501ee54b1f5de924895b35e64
* Replaced mox with mock in test_loguserdataJay Dobies2015-10-121-1/+1
| | | | | | Also fixed a bug in loguserdata for an incorrect tuple instantiation Change-Id: Ic7bcf018b771505e3ef6c747e0624f929463eb5b
* Try to get the version of cloud init via popenOleksii Chuprykov2015-08-061-8/+24
| | | | | | | | | Now we can fail while trying to get the version of cloud-init via pkg_resources. Try to get the version via ordinary cmd call 'cloud-init --version'. Change-Id: I39d4d52ba1ac83183a0a46c7f3a70a14b782562a Closes-Bug: #1481614
* Update the rest of the code to satisfy flake8 in a py34 envSirushti Murugesan2015-04-241-1/+1
| | | | | | | | | | | * Use six.moves.reduce * Update numliteral from 0L to 0 * Use open() instead of file() * Use rich comparison methods instead of cmp() partial blueprint heat-python34-support Change-Id: I9ffd85645563192b5d6124f8dbb71c24245eefc4
* Enable H305 and H307 style checksPavlo Shchelokovskyy2015-01-201-1/+2
| | | | | | Correct grouping and ordering of imports Change-Id: I47ea0d53f80d7f0aeb01c1c6afd63713be87ddf4
* Remove i18n import from loguserdata.pyTetiana Lashchova2014-12-051-11/+8
| | | | | Change-Id: I47bc858e6f0d0b92a103cf40fdf47e1c8d5c89c5 Closes-Bug: #1399642
* Use the right log marker functionsTetiana Lashchova2014-12-021-8/+11
| | | | | | | | | | | | According to [1] _LI() should be used for LOG.info(), _LE() for LOG.exception() and LOG.error(), _LW() for LOG.warning(). The log marker functions must only be used when the message is sent directly to the log. Debug level log messages should not be translated. [1] http://docs.openstack.org/developer/oslo.i18n/guidelines.html Change-Id: Ib9f92ef6696b9a95ddae74f0d4a0a557c06ecc91
* Fix [H302] errors in heat/cloudinitPeter Razumovsky2014-11-181-3/+4
| | | | | Kicked from gate (heat can't pass pep8 atm) Change-Id: If9100574f091d23c9ae9e0bca94ab16fd4b535ec
* Fix cloud-init Python syntax for Python < 2.6Zane Bitter2014-10-011-5/+10
| | | | | | | | | | | | | | | | | | The loguserdata.py file gets uploaded to the servers created by Heat to run under cloud-init. Since the default versions of Python installed on the user's server may be very old (e.g. RHEL 5 defaults to Python 2.4), avoid using the octal syntax introduced for Python 3.0 and backported only as far as Python 2.6. (Also avoid the old syntax, which will break on Python 3.x.) Also remove use of the "with" statement from loguserdata.py and part-handler.py. This statement is only available from Python 2.6 on (or in Python 2.5 via "from __future__ import with_statement"). Finally, remove use of the "except ExceptionType as value" syntax for catching exceptions. Again, this was only backported to Python 2.6. Change-Id: I89e86d00993d51e2514b1e589503c6d966909403 Partial-Bug: #1375864
* Remove translation from loguserdataThomas Herve2014-06-011-8/+8
| | | | | | | | | The logs in loguserdata don't need to be translated because it's sent with the po files to instances, and actually break because of gettext not being used Closes-Bug: #1325313 Change-Id: I365f3d882b8f64f9710eea4901ac266f9fcf0da3
* all non debug log messages should be translatedChristian Berendt2014-05-291-9/+9
| | | | | | | | Updated a set of files to add missing translation support in the log messages. Change-Id: I58d561c5e1ecff550483ee0be696999e927c98ad Partial-Bug: #1321283
* Merge "Make the first line of every file consistent."Jenkins2014-04-081-1/+1
|\
| * Make the first line of every file consistent.Jason Dunsmore2014-03-041-1/+1
| | | | | | | | Change-Id: I2e1a809cfca8e88693551d58d33e747f54ee5eb1
* | Order imports in alphabetical order (3/9)Pavlo Shchelokovskyy2014-02-251-4/+3
|/ | | | | | | | This patch is one in a series to re-enable H306 style check rule (imports are in alphabetical order). It touches common and cloudinit files. Implements: blueprint reduce-flake8-ignored-rules (partial) Change-Id: Ie9838dba11323575165fc3bfdfbd0d0b93f653fa
* Change loglevel for certain failuresDennyZhang2013-12-221-2/+2
| | | | | | | Change Log.info to Log.error/Log.warning to make trouble shooting more apparent Change-Id: Ie293df0c941414da8fb035e4d4b170a0a4c9d397
* Revert "Replace part_handler.py with write-files cloudinit mechanism"Steven Dake2013-08-051-0/+1
| | | | | | | | | | | Ubuntu has 0.6 of cloudinit, and write-files doesn't work on that distro. Ubuntu does not intend to update cloudinit in their LTS release to 0.7. This reverts commit 621f5bfdbab46498b37cdc4865afa57e0f0498e0. Fixes: Bug #1207088 Change-Id: If80863883afee28bdde6dd506826ec5710cc0308
* Replace part_handler.py with write-files cloudinit mechanismSteven Dake2013-07-301-1/+0
| | | | | | | | | part-handler.py was acting as a write-files mechanism. Instead just use the write-files mechanism directly to avoid the complexities of the part-handler. blueprint: use-cloudinit-write Change-Id: I6e80c344743d6fd2fa9a49507de6d50e3d9eea73
* Merge "Fix loguserdata output to file issue"Jenkins2013-07-241-5/+6
|\
| * Fix loguserdata output to file issueguohliu2013-07-231-5/+6
| | | | | | | | | | | | Fixes bug #1191685 Change-Id: I2a02b490e45c3cb838243b9dad62cc52b609b336
* | Use new style classesAngus Salkeld2013-07-231-1/+1
| | | | | | | | | | | | Change a couple of old style classes into the newer styled ones. Change-Id: Ide3bbcd2d24f949a2a550fcc2210617f34c8cd0b
* | Add missing Aapche 2.0 license headers (H102)Dirk Mueller2013-07-191-0/+12
|/ | | | | | Satisfy Hacking check of Hacking 0.6 or newer. Change-Id: I01d9b44c1681142ef91fd91f678e173239ae6c98
* Use Python 3.x compatible octal literalsDirk Mueller2013-06-101-2/+2
| | | | | | | Python 3.x deprecated the 0700 construct. 0o700 works with any version of Python (>= 2.6 tested) Change-Id: I47fcb79804b75437e6cf4ce966fbfdc05fce26cd
* Use python logging for loguserdata.py, log to consoleSteve Baker2013-05-151-24/+39
| | | | | | | | | | | | | | | | Python logging is configured with a stream handler and should also replicate the previous logging to 0600 /var/log/heat-provision.log By logging to a stream handler cloud-init will write to its log, which will show up in the server console log. This means that heat provisioning can now be monitored without needing to log in with: nova console-log <servername> This change also touches the file /var/lib/heat-cfntools/provision-finished instead of also writing a datestamp to it, which is redundant. Change-Id: Id0312bd2216a83753df601b17ad16d5355cdb11d
* Change executable file permissions for rpmlintJeff Peeler2013-03-201-0/+0
| | | | | | Fixes: Bug #1158009 Change-Id: I761debfb77be5cf5204af90a013d7f4f043fdb17 Signed-off-by: Jeff Peeler <jpeeler@redhat.com>
* loguserdata: handle exceptions from running the userdataAngus Salkeld2013-03-141-2/+14
| | | | | | | | - log the exceptions so the user can diagnose issues. bug 1154641 Change-Id: Ic085c9f062255a9fa44b3e31b464c9ebd19a947c Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
* loguserdata: prevent shadowing of arguments and globalsAngus Salkeld2013-03-141-23/+25
| | | | | | | cleaning this up for bug 1154641 Change-Id: I95271bdeba1bba29e78af79de4e2173d07750e4f Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
* Remove unused import from loguserdata.pySteven Dake2013-02-281-1/+0
| | | | | Change-Id: I0bdf8a51e0d21533c5ce8148cdffcbc92f89fef9 Fixes: Bug #1131275
* Put heat data files in /var/lib/heat-cfntoolsSteven Dake2013-02-271-8/+3
| | | | | | | | | | | | | | The /var/lib/heat-cfntools directory should be owned by the heat-cfntools package for whichever distro it is included. This avoids the problem of heat writing to directories owned by cloud-init. For the moment, the part handler will continue to write to /var/lib/cloud/data to be removed at a later date. Change-Id: I70b714c70ed146d4f6807850d6e7264c6a4624cd Fixes: Bug #1105806
* Refactor loguserdata.py so it can be tested.Steve Baker2013-02-071-21/+45
| | | | | | | | | | | | | - Use distutils.version.LooseVersion for cloud-init version check - Fix bug 1100287 by setting the following modes: - 0600 /var/log/heat-provision.log - 0700 /var/lib/heat - 0700 /var/lib/cloud/data/cfn-userdata (was 0111!) - Full test coverage except for where __name__ == '__main__' - File size has gone from 1218 bytes to 1636. If necessary we could reduce size in the future by using short names This works for me when launching a template. At least if there are any regressions they can have a test written for the fix. Change-Id: I04e773a743ec210e90394e50d2bb70c70664e80e
* Hardcode provision-finished file pathJeff Peeler2013-01-301-3/+12
| | | | | | | | | A recent change removed the use of the cloudinit module, so write this log to /var/lib/heat. Functional test paths updated as well. (User data injection was removed, so that has been deleted as well.) Change-Id: Ibcaf310a5e4ff9a9ed8b1065bdd411e1b95d4de5 Signed-off-by: Jeff Peeler <jpeeler@redhat.com>
* Use pkg_resources to detect version of cloud-initClint Byrum2013-01-231-5/+4
| | | | | | | | Previously the present of an API call only present in cloud-init 0.6.x was used to determine whether or not cfn-userdata would have been executed or not. The API call was removed in 0.7.x. This Fixes bug #1103793 Change-Id: I27129f8ae6144ae7172b7159ed70fc5f0d7d07b9
* Handle different cloud-init versions gracefullyJeff Peeler2013-01-071-0/+33
Change loguserdata script to python to allow easy detection of which version of cloud-init installed. Some logging was added to part-handler. Took out injecting the command to touch provision-finished in the user data. This is now handled in loguserdata.py. Note that up until cloud-init version 0.6.0, the user data is not passed to part-handler. This behavior is why it's not possible to log the provisioning process with older versions. (Technically could rely on the redirection support added post 0.6.0, but having a separate file just for provisioning seems beneficial.) fixes bug 1072921 Change-Id: I9005a21bfb74f27208f9195a6e10e1d2b474e91f Signed-off-by: Jeff Peeler <jpeeler@redhat.com>