~james-page/charms/trusty/neutron-api/lp1531102

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/core/host.py

  • Committer: Liam Young
  • Date: 2015-10-19 06:36:41 UTC
  • mfrom: (152.1.5 neutron-api)
  • Revision ID: liam.young@canonical.com-20151019063641-leixdk02j0dnv2g0
Tags: 15.10
[1chb1n, r=gnuoy] Update amulet tests for Trusty-Liberty, Wily-Liberty.

Sync charmhelpers.

Add service and relations to satisfy workload status ready state.

Add new logic to wait for extended status message to confirm deploy is ready, before testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
566
566
        os.chdir(cur)
567
567
 
568
568
 
569
 
def chownr(path, owner, group, follow_links=True):
 
569
def chownr(path, owner, group, follow_links=True, chowntopdir=False):
 
570
    """
 
571
    Recursively change user and group ownership of files and directories
 
572
    in given path. Doesn't chown path itself by default, only its children.
 
573
 
 
574
    :param bool follow_links: Also Chown links if True
 
575
    :param bool chowntopdir: Also chown path itself if True
 
576
    """
570
577
    uid = pwd.getpwnam(owner).pw_uid
571
578
    gid = grp.getgrnam(group).gr_gid
572
579
    if follow_links:
574
581
    else:
575
582
        chown = os.lchown
576
583
 
 
584
    if chowntopdir:
 
585
        broken_symlink = os.path.lexists(path) and not os.path.exists(path)
 
586
        if not broken_symlink:
 
587
            chown(path, uid, gid)
577
588
    for root, dirs, files in os.walk(path):
578
589
        for name in dirs + files:
579
590
            full = os.path.join(root, name)