Merge lp:~corey.bryant/charm-helpers/systemd into lp:charm-helpers

Proposed by Corey Bryant on 2016-02-24
Status: Merged
Merged at revision: 575
Proposed branch: lp:~corey.bryant/charm-helpers/systemd
Merge into: lp:charm-helpers
Diff against target: 59 lines (+42/-0)
1 file modified
charmhelpers/contrib/openstack/utils.py (+42/-0)
To merge this branch: bzr merge lp:~corey.bryant/charm-helpers/systemd
Reviewer Review Type Date Requested Status
James Page 2016-05-20 Needs Fixing on 2016-05-20
charmers 2016-02-24 Pending
Review via email: mp+287110@code.launchpad.net
To post a comment you must log in.
534. By James Page on 2016-03-01

Update driver details for PLUMgrid >= liberty

535. By James Page on 2016-03-02

Fix SSL cipher suites to enforce TLS v1 or better.

536. By James Page on 2016-03-03

ceph: support use of monitor cluster as a key/value store

537. By James Page on 2016-03-07

Add support for Juju 2.0 network spaces

Juju 2.0 adds a new hook tool called network-get to query for network
information for named relations and extra-bindings.

Add basic hook tool support and associated unit tests.

538. By Charles Butler on 2016-03-07

  [r,a=lazypower] Chris Holcombe 2016-03-04 Typo in the ceph config-key commands. This removes the extra ceph parameter that should not be there

539. By Liam Young on 2016-03-08

[ajkavanagh, r=gnuoy] Support pause/resume functionality for OpenStack charms. Pause and resume are baked into set_os_workload_status() and also perform additional checks using service_running() and port listening checks.

540. By Liam Young on 2016-03-08

[gnuoy, trivial] whitespace lint fix

541. By Liam Young on 2016-03-08

[ajkavanagh, r=gnuoy] Fixes broken *_unit_paused_set() functions in contrib/openstack/utils.py that were merged by mistake.

Also fixes some PEP8 formatting in the utils.py and test_openstack_utils.py files (line lengths).

542. By James Page on 2016-03-09

Enable Keystone v3 api in amulet

543. By Marco Ceppi on 2016-03-09

[marcoceppi] Support resource-get command

544. By Marco Ceppi on 2016-03-09

version bump

545. By James Page on 2016-03-11

[trivial] Add swift 2.6.0 to the openstack mitaka series

546. By James Page on 2016-03-11

Ensure that keystone api version defaults to 2, not 3

This resolves a number of amulet test failures after resyncs of the
keystone v3 testing support.

547. By Charles Butler on 2016-03-14

  [r,a=lazypower] Chris Holcombe 2016-03-09 Ceph command should really be rados command for the flush cache tier

548. By Liam Young on 2016-03-15

[ajkavanagh, r=gnuoy] Fix lp:1555643 - c.o.amulet.utils imports removed novaclient.v1_1 module

  As per http://docs.openstack.org/developer/python-novaclient/api.html
  the novaclient module needs to be imported as:

  from novaclient import client
  c = client.Client(VERSION, ...)

  as opposed to

  from novaclient.VERSION import client
  c = client.Client(...)

549. By Liam Young on 2016-03-18

[gnuoy, r=wolsen] The settings in keystone_authtoken do not depend on keystone api version in releases over > juno. See details in Bug #1557223

550. By Liam Young on 2016-03-18

[wolsen, hopem, r=gnuoy] This merge proposal adds the base for hardening the host OS and SSH as utility libraries which can be imported into any charm. This also adds the stubs for MySQL and Apache, which will come in later merge proposals.

The hardening efforts are based on the upstream hardening.io project, which can be found at http://hardening.io.

551. By Liam Young on 2016-03-18

[gnuoy, trivial] lint fix

552. By Charles Butler on 2016-03-18

  [r=lazypower] Chris Holcombe 2016-03-18 Add parameters to the run action utility in amulet

553. By Liam Young on 2016-03-21

[hopem, r=gnuoy] contrib.hardening fixups (mostly unit test fixes)

554. By Edward Hope-Morley on 2016-03-22

[trivial] contrib.hardening default use_pam=no

555. By Charles Butler on 2016-03-29

[r=beisner,a=lazypower] Anton Skriptsov 2016-03-22 add NexentaEdge's charms to no_origin list

556. By David Ames on 2016-03-30

[jamespage, r=thedac] Add extra-binding awareness to openstack api endpoint resolver

557. By James Page on 2016-04-01

Add InternalEndpointContext to contrib.openstack.context

558. By Edward Hope-Morley on 2016-04-01

[gnuoy,r=hopem]

When checking if a System V service is running, query
service --all-status which keeps track of the services
and their return codes.

Closes-Bug: 1564842

559. By David Ames on 2016-04-04

[thedac, r=jamespage] Apparmor context class for OpenStack charms

The class will validate aa-profile-mode config settings and either set
the profile to enforce, complain or disable.

560. By David Ames on 2016-04-04

[coreycb, r=thedac] Add support for keystone liberty release 8.1.0

561. By David Ames on 2016-04-05

[jamespage, r=thedac] Add support for specifying the datapath type of an ovs bridge

562. By Ryan Beisner on 2016-04-05

[chris.macnaughton, r=1chb1n] Allow the validate_unit_process_ids test helper to accept a list of valid values

563. By Ryan Beisner on 2016-04-07

[chris.macnaughton, r=1chb1n] Trivial lint fix

564. By James Page on 2016-04-08

Allow custom functions to be used to restart services in the restart_on_change functions.

565. By James Page on 2016-04-11

[trivial] Add 2.7.0 to the list of swift mitaka releases.

566. By Ryan Beisner on 2016-04-14

[xfactor973, r=1chb1n] Add the final update_pool call in Ceph pool creation to set the replica count (bug 1565120)

567. By Ryan Beisner on 2016-04-15

[xfactor973, r=1chb1n] Add mandatory flag for ceph jewel and above

568. By Liam Young on 2016-04-18

[gnuoy, r=james-page] Add openstack mitaka compatible template for keystone-authtoken

569. By Edward Hope-Morley on 2016-04-20

[hopem,r=gnuoy]

Fix contib.storage.linux.ceph pool_exists()
Partially-Closes-Bug: 1572506

570. By James Page on 2016-04-20

Switch is_device_mounted to use lsblk

This will correct detect a wider range of 'is use' states compared
to parsing the output of /proc/mounts, including block devices that
are part of LVM volumes.

571. By James Page on 2016-05-12

Add support for mitaka/neutron 8.1.x series

572. By David Ames on 2016-05-13

[thedac,r=tinwood] Actively check for stopped message(s) in service_running

573. By James Page on 2016-05-18

Fix ipv6 address recongition under xenial.

574. By James Page on 2016-05-18

Refactor service_running to determine init approach

Use of "service --status-all" has some challenges on trusty where
a recent lsb-base update resulted in all calls being diverted to
upstart, where return codes for non-running daemons are still 0.

Detect whether to use upstart or the base init.d script to
determine whether a service is running, and look at either the
upstart output, or for a non-zero return code from an init.d
status call.

575. By Corey Bryant on 2016-05-19

Add function to generate systemd init files for OpenStack deploy from source.

Corey Bryant (corey.bryant) wrote :

Here's a sample usage of this code from keystone. I'm still debugging some other issues with it but it looks like init files are getting set up fine. https://github.com/coreycb/charm-keystone/commit/672e5e58292215536054c95dfcf1d4ed12af7b06

James Page (james-page) :
review: Needs Fixing
576. By Corey Bryant on 2016-05-20

Use format() in service_file assignment

577. By Corey Bryant on 2016-05-20

Add an empty line to init_source file before appending template to it

Corey Bryant (corey.bryant) wrote :

James, thanks for the review. This is fixed up based on your comment and another minor change for adding an empty line to init_source file before appending the template to it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/openstack/utils.py'
2--- charmhelpers/contrib/openstack/utils.py 2016-05-12 15:10:33 +0000
3+++ charmhelpers/contrib/openstack/utils.py 2016-05-23 15:53:53 +0000
4@@ -25,6 +25,7 @@
5 import re
6 import itertools
7 import functools
8+import shutil
9
10 import six
11 import tempfile
12@@ -858,6 +859,47 @@
13 return None
14
15
16+def git_generate_systemd_init_files(templates_dir):
17+ """
18+ Generate systemd init files.
19+
20+ Generates and installs systemd init units and script files based on the
21+ *.init.in files contained in the templates_dir directory.
22+
23+ This code is based on the openstack-pkg-tools package and its init
24+ script generation, which is used by the OpenStack packages.
25+ """
26+ for f in os.listdir(templates_dir):
27+ if f.endswith(".init.in"):
28+ init_in_file = f
29+ init_file = f[:-8]
30+ service_file = "{}.service".format(init_file)
31+
32+ init_in_source = os.path.join(templates_dir, init_in_file)
33+ init_source = os.path.join(templates_dir, init_file)
34+ service_source = os.path.join(templates_dir, service_file)
35+
36+ init_dest = os.path.join('/etc/init.d', init_file)
37+ service_dest = os.path.join('/lib/systemd/system', service_file)
38+
39+ shutil.copyfile(init_in_source, init_source)
40+ with open(init_source, 'a') as outfile:
41+ template = '/usr/share/openstack-pkg-tools/init-script-template'
42+ with open(template) as infile:
43+ outfile.write('\n\n{}'.format(infile.read()))
44+
45+ cmd = ['pkgos-gen-systemd-unit', init_in_source]
46+ subprocess.check_call(cmd)
47+
48+ if os.path.exists(init_dest):
49+ os.remove(init_dest)
50+ if os.path.exists(service_dest):
51+ os.remove(service_dest)
52+ shutil.move(init_source, init_dest)
53+ shutil.move(service_source, service_dest)
54+ os.chmod(init_dest, 0o755)
55+
56+
57 def os_workload_status(configs, required_interfaces, charm_func=None):
58 """
59 Decorator to set workload status based on complete contexts

Subscribers

People subscribed via source and target branches