~smoser/cloud-init/lp-1077700

« back to all changes in this revision

Viewing changes to cloudinit/config/cc_landscape.py

  • Committer: Scott Moser
  • Author(s): Joshua Harlow
  • Date: 2012-11-07 15:42:54 UTC
  • mfrom: (696.1.2 pylint-join-cleanup)
  • Revision ID: smoser@ubuntu.com-20121107154254-lhs4c0cu79unybbs
test and path cleanups.

1. Remove the usage of the path.join function now that all code should
   be going through the util file methods (and they can be mocked out as
   needed).
2. Adjust all occurences of the above join function to either not use it
   or replace it with the standard os.path.join (which can also be mocked
   out as needed)
3. Fix pylint from complaining about the tests folder 'helpers.py' not
   being found.
4. Add a pylintrc file that is used instead of the options hidden in the
   'run_pylint' tool.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
 
67
67
    merge_data = [
68
68
        LSC_BUILTIN_CFG,
69
 
        cloud.paths.join(True, LSC_CLIENT_CFG_FILE),
 
69
        LSC_CLIENT_CFG_FILE,
70
70
        ls_cloudcfg,
71
71
    ]
72
72
    merged = merge_together(merge_data)
73
 
 
74
 
    lsc_client_fn = cloud.paths.join(False, LSC_CLIENT_CFG_FILE)
75
 
    lsc_dir = cloud.paths.join(False, os.path.dirname(lsc_client_fn))
76
 
    if not os.path.isdir(lsc_dir):
77
 
        util.ensure_dir(lsc_dir)
78
 
 
79
73
    contents = StringIO()
80
74
    merged.write(contents)
81
 
    contents.flush()
82
75
 
83
 
    util.write_file(lsc_client_fn, contents.getvalue())
84
 
    log.debug("Wrote landscape config file to %s", lsc_client_fn)
 
76
    util.ensure_dir(os.path.dirname(LSC_CLIENT_CFG_FILE))
 
77
    util.write_file(LSC_CLIENT_CFG_FILE, contents.getvalue())
 
78
    log.debug("Wrote landscape config file to %s", LSC_CLIENT_CFG_FILE)
85
79
 
86
80
    util.write_file(LS_DEFAULT_FILE, "RUN=1\n")
87
81
    util.subp(["service", "landscape-client", "restart"])