compare directories
(self, local_path, deployed_path, ignore)
| 136 | return self._compare_dirs2(local_path, deployed_path, ignore) |
| 137 | |
| 138 | def _compare_dirs2(self, local_path, deployed_path, ignore): |
| 139 | """compare directories""" |
| 140 | self.log.dbg(f'compare dirs {local_path} and {deployed_path}') |
| 141 | ret = [] |
| 142 | |
| 143 | local_tree = FTreeDir(local_path, ignores=ignore, debug=self.debug) |
| 144 | deploy_tree = FTreeDir(deployed_path, ignores=ignore, debug=self.debug) |
| 145 | lonly, ronly, common = local_tree.compare(deploy_tree) |
| 146 | |
| 147 | for i in lonly: |
| 148 | path = os.path.join(local_path, i) |
| 149 | if os.path.isdir(path): |
| 150 | # ignore dir |
| 151 | continue |
| 152 | ret.append(f'=> \"{path}\" does not exist on destination\n') |
| 153 | if not self.ignore_missing_in_dotdrop: |
| 154 | for i in ronly: |
| 155 | path = os.path.join(deployed_path, i) |
| 156 | if os.path.isdir(path): |
| 157 | # ignore dir |
| 158 | continue |
| 159 | ret.append(f'=> \"{path}\" does not exist in dotdrop\n') |
| 160 | |
| 161 | # test for content difference |
| 162 | # and mode difference |
| 163 | self.log.dbg(f'common files {common}') |
| 164 | for i in common: |
| 165 | source_file = os.path.join(local_path, i) |
| 166 | deployed_file = os.path.join(deployed_path, i) |
| 167 | subret = self._compare(source_file, deployed_file, |
| 168 | ignore=None, mode=None, |
| 169 | recurse=False) |
| 170 | ret.extend(subret) |
| 171 | |
| 172 | return ''.join(ret) |
| 173 | |
| 174 | def _diff(self, local_path, deployed_path, header=False): |
| 175 | """diff two files""" |