bad test for snappy systems

Bug #1639955 reported by Steve Langasek
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Medium
Unassigned
cloud-init (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Reviewing the latest SRU for cloud-init, I noticed the following:

def system_is_snappy():
    # channel.ini is configparser loadable.
    # snappy will move to using /etc/system-image/config.d/*.ini
    # this is certainly not a perfect test, but good enough for now.
    content = load_file("/etc/system-image/channel.ini", quiet=True)
    if 'ubuntu-core' in content.lower():
        return True
    if os.path.isdir("/etc/system-image/config.d/"):
        return True
    return False

This isn't a good test for whether a system is an ubuntu-core system. 'system-image' is historical baggage, and not likely to be present at all in future versions.

I'm afraid I don't know a good alternative test offhand, but wanted to log the bug so someone could look into it rather than being caught by surprise when ubuntu-core image contents later change.

Scott Moser (smoser)
Changed in cloud-init (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Ryan Harper (raharper) wrote :

This issue was fixed a while back in:

https://github.com/canonical/cloud-init/commit/4bcc94730

cloud-init retains the legacy bits, but prefers the use of os-release file or kernel commandline to for checking for UbuntuCore.

Changed in cloud-init (Ubuntu):
status: Confirmed → Fix Released
Changed in cloud-init:
status: Confirmed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.