Giuseppe Lavagetto has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/369611 )
Change subject: Drop dead code to do diffing by shelling out.
......................................................................
Drop dead code to do diffing by shelling out.
Change-Id: I350f8c1be2ba2578b66363529c162099cb7a8a1a
---
M puppet_compiler/puppet.py
M puppet_compiler/tests/test_puppet.py
2 files changed, 1 insertion(+), 38 deletions(-)
Approvals:
Giuseppe Lavagetto: Looks good to me, approved
jenkins-bot: Verified
diff --git a/puppet_compiler/puppet.py b/puppet_compiler/puppet.py
index dd07307..f10c8db 100644
--- a/puppet_compiler/puppet.py
+++ b/puppet_compiler/puppet.py
@@ -43,21 +43,3 @@
for line in out:
if not re.match('(Info|[Nn]otice|[Ww]arning)', line):
f.write(line)
-
-
-def diff(env, hostname, base='prod'):
- """
- Compute the diffs between the two changes
- """
- hostfiles = HostFiles(hostname)
- prod_catalog = hostfiles.file_for(base, 'catalog')
- change_catalog = hostfiles.file_for(env, 'catalog')
- output = hostfiles.file_for(env, 'diff')
- cmd = ['puppet', 'catalog', 'diff', '--show_resource_diff',
- '--content_diff', prod_catalog, change_catalog]
- temp = spoolfile()
- subprocess.check_call(cmd, stdout=temp)
- with open(output, 'w') as out:
- temp.seek(0)
- # Remove bold from term output
- out.write(temp.read().replace('\x1b[1m', '').replace('\x1b[0m', ''))
diff --git a/puppet_compiler/tests/test_puppet.py
b/puppet_compiler/tests/test_puppet.py
index bfd858a..f77d3c1 100644
--- a/puppet_compiler/tests/test_puppet.py
+++ b/puppet_compiler/tests/test_puppet.py
@@ -3,7 +3,7 @@
import subprocess
import os
from puppet_compiler import puppet
-from puppet_compiler.directories import FHS, HostFiles
+from puppet_compiler.directories import FHS
class TestPuppetCalls(unittest.TestCase):
@@ -98,22 +98,3 @@
mock.call(hostfile + '.err', 'w'),
]
mocker.assert_has_calls(calls, any_order=True)
-
- @mock.patch('puppet_compiler.puppet.spoolfile')
- def test_diff(self, tf_mocker):
- hostfiles = HostFiles('test.codfw.wmnet')
- m = mock.mock_open(read_data='wat')
- with mock.patch('__builtin__.open', m, True) as mocker:
- puppet.diff('change', 'test.codfw.wmnet')
- mocker.assert_called_with(hostfiles.file_for('change', 'diff'), 'w')
-
- subprocess.check_call.called_with(
- ['puppet',
- 'catalog',
- 'diff',
- '--show_resource_diff',
- '--content_diff',
- hostfiles.file_for('production', 'catalog'),
- hostfiles.file_for('change', 'catalog')],
- stdout=tf_mocker.return_value
- )
--
To view, visit https://gerrit.wikimedia.org/r/369611
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I350f8c1be2ba2578b66363529c162099cb7a8a1a
Gerrit-PatchSet: 3
Gerrit-Project: operations/software/puppet-compiler
Gerrit-Branch: master
Gerrit-Owner: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits