File: DataSourceNoCacheWithFallback.py

package info (click to toggle)
cloud-init 25.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,412 kB
  • sloc: python: 135,894; sh: 3,883; makefile: 141; javascript: 30; xml: 22
file content (29 lines) | stat: -rw-r--r-- 583 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import logging
import os

from cloudinit import sources

LOG = logging.getLogger(__name__)


class DataSourceNoCacheWithFallback(sources.DataSource):
    def _get_data(self):
        if os.path.exists("/ci-test-firstboot"):
            LOG.debug("TEST _get_data called")
            return True
        return False

    def check_if_fallback_is_allowed(self):
        return True


datasources = [
    (
        DataSourceNoCacheWithFallback,
        (sources.DEP_FILESYSTEM,),
    ),
]


def get_datasource_list(depends):
    return sources.list_from_depends(depends, datasources)