Exemple #1
0
 def setUp(self):
     super(TestRepo, self).setUp()
     base._run_cmd(["git", "init", "."], self._basedir)
     base._run_cmd(["git", "config", "--global", "user.email", "*****@*****.**"], self._basedir)
     base._run_cmd(["git", "config", "--global", "user.name", "OpenStack Developer"], self._basedir)
     base._run_cmd(["git", "config", "--global", "user.signingkey", "*****@*****.**"], self._basedir)
     base._run_cmd(["git", "add", "."], self._basedir)
Exemple #2
0
    def setUp(self):
        super(GPGKeyFixture, self).setUp()
        tempdir = self.useFixture(fixtures.TempDir())
        gnupg_version_re = re.compile('^gpg\s.*\s([\d+])\.([\d+])\.([\d+])')

        for proc in psutil.process_iter():
            if proc.name() == 'gpg-agent':
                proc.kill()

        gnupg_version = base._run_cmd(['gpg', '--version'], tempdir.path)
        for line in gnupg_version[0].split('\n'):
            gnupg_version = gnupg_version_re.match(line)
            if gnupg_version:
                gnupg_version = (int(gnupg_version.group(1)),
                                 int(gnupg_version.group(2)),
                                 int(gnupg_version.group(3)))
                break
        else:
            if gnupg_version is None:
                gnupg_version = (0, 0, 0)
        config_file = tempdir.path + '/key-config'
        f = open(config_file, 'wt')
        try:
            if gnupg_version[0] == 2 and gnupg_version[1] >= 1:
                f.write("""
                %no-protection
                %transient-key
                """)
            f.write("""
            %no-ask-passphrase
            Key-Type: RSA
            Name-Real: Example Key
            Name-Comment: N/A
            Name-Email: [email protected]
            Expire-Date: 2d
            Preferences: (setpref)
            %commit
            """)
        finally:
            f.close()
        # Note that --quick-random (--debug-quick-random in GnuPG 2.x)
        # does not have a corresponding preferences file setting and
        # must be passed explicitly on the command line instead
        if gnupg_version[0] == 1:
            gnupg_random = '--quick-random'
        elif gnupg_version[0] >= 2:
            gnupg_random = '--debug-quick-random'
        else:
            gnupg_random = ''
        base._run_cmd(
            ['gpg', '--gen-key', '--batch', gnupg_random, config_file],
            tempdir.path)
 def setUp(self):
     super(TestRepo, self).setUp()
     base._run_cmd(['git', 'init', '.'], self._basedir)
     base._run_cmd(
         ['git', 'config', '--global', 'user.email', '*****@*****.**'],
         self._basedir)
     base._run_cmd(
         ['git', 'config', '--global', 'user.name', 'OpenStack Developer'],
         self._basedir)
     base._run_cmd(
         ['git', 'config', '--global', 'user.signingkey',
          '*****@*****.**'], self._basedir)
     base._run_cmd(['git', 'add', '.'], self._basedir)
Exemple #4
0
 def setUp(self):
     super(TestRepo, self).setUp()
     base._run_cmd(['git', 'init', '.'], self._basedir)
     base._run_cmd(
         ['git', 'config', '--global', 'user.email', '*****@*****.**'],
         self._basedir)
     base._run_cmd(
         ['git', 'config', '--global', 'user.name', 'OpenStack Developer'],
         self._basedir)
     base._run_cmd(
         ['git', 'config', '--global', 'user.signingkey',
          '*****@*****.**'], self._basedir)
     base._run_cmd(['git', 'add', '.'], self._basedir)
 def setUp(self):
     super(GPGKeyFixture, self).setUp()
     tempdir = self.useFixture(fixtures.TempDir())
     gnupg_version_re = re.compile('^gpg\s.*\s([\d+])\.([\d+])\.([\d+])')
     gnupg_version = base._run_cmd(['gpg', '--version'], tempdir.path)
     for line in gnupg_version[0].split('\n'):
         gnupg_version = gnupg_version_re.match(line)
         if gnupg_version:
             gnupg_version = (int(gnupg_version.group(1)),
                              int(gnupg_version.group(2)),
                              int(gnupg_version.group(3)))
             break
     else:
         if gnupg_version is None:
             gnupg_version = (0, 0, 0)
     config_file = tempdir.path + '/key-config'
     f = open(config_file, 'wt')
     try:
         if gnupg_version[0] == 2 and gnupg_version[1] >= 1:
             f.write("""
             %no-protection
             %transient-key
             """)
         f.write("""
         %no-ask-passphrase
         Key-Type: RSA
         Name-Real: Example Key
         Name-Comment: N/A
         Name-Email: [email protected]
         Expire-Date: 2d
         Preferences: (setpref)
         %commit
         """)
     finally:
         f.close()
     # Note that --quick-random (--debug-quick-random in GnuPG 2.x)
     # does not have a corresponding preferences file setting and
     # must be passed explicitly on the command line instead
     if gnupg_version[0] == 1:
         gnupg_random = '--quick-random'
     elif gnupg_version[0] >= 2:
         gnupg_random = '--debug-quick-random'
     else:
         gnupg_random = ''
     base._run_cmd(
         ['gpg', '--gen-key', '--batch', gnupg_random, config_file],
         tempdir.path)
Exemple #6
0
 def setUp(self):
     super(TestRepo, self).setUp()
     base._run_cmd(['git', 'init', '.'], self._basedir)
     base._run_cmd(
         ['git', 'config', '--global', 'user.email', '*****@*****.**'],
         self._basedir)
     base._run_cmd(['git', 'add', '.'], self._basedir)
Exemple #7
0
 def setUp(self):
     super(TestRepo, self).setUp()
     base._run_cmd(['git', 'init', '.'], self._basedir)
     base._run_cmd(
         ['git', 'config', '--global', 'user.email', '*****@*****.**'],
         self._basedir)
     base._run_cmd(['git', 'add', '.'], self._basedir)
Exemple #8
0
 def setUp(self):
     super(GPGKeyFixture, self).setUp()
     tempdir = self.useFixture(fixtures.TempDir())
     config_file = tempdir.path + '/key-config'
     f = open(config_file, 'wt')
     try:
         f.write("""
         #%no-protection -- these would be ideal but they are documented
         #%transient-key -- but not implemented in gnupg!
         %no-ask-passphrase
         Key-Type: RSA
         Name-Real: Example Key
         Name-Comment: N/A
         Name-Email: [email protected]
         Expire-Date: 2d
         Preferences: (setpref)
         %commit
         """)
     finally:
         f.close()
     base._run_cmd(
         ['gpg', '--gen-key', '--batch', config_file], tempdir.path)
 def setUp(self):
     super(GPGKeyFixture, self).setUp()
     tempdir = self.useFixture(fixtures.TempDir())
     config_file = tempdir.path + '/key-config'
     f = open(config_file, 'wt')
     try:
         f.write("""
         #%no-protection -- these would be ideal but they are documented
         #%transient-key -- but not implemented in gnupg!
         %no-ask-passphrase
         Key-Type: RSA
         Name-Real: Example Key
         Name-Comment: N/A
         Name-Email: [email protected]
         Expire-Date: 2d
         Preferences: (setpref)
         %commit
         """)
     finally:
         f.close()
     # Note that --quick-random (--debug-quick-random in GnuPG 2.x)
     # does not have a corresponding preferences file setting and
     # must be passed explicitly on the command line instead
     gnupg_version_re = re.compile('gpg .* ([12])\.')
     gnupg_version = base._run_cmd(['gpg', '--version'], tempdir.path)
     for line in gnupg_version[0].split('\n'):
         gnupg_version = gnupg_version_re.match(line)
         if gnupg_version:
             gnupg_version = gnupg_version.group(1)
             break
     if gnupg_version == '1':
         gnupg_random = '--quick-random'
     elif gnupg_version == '2':
         gnupg_random = '--debug-quick-random'
     else:
         gnupg_random = ''
     base._run_cmd(
         ['gpg', '--gen-key', '--batch', gnupg_random, config_file],
         tempdir.path)
 def setUp(self):
     super(GPGKeyFixture, self).setUp()
     tempdir = self.useFixture(fixtures.TempDir())
     config_file = tempdir.path + '/key-config'
     f = open(config_file, 'wt')
     try:
         f.write("""
         #%no-protection -- these would be ideal but they are documented
         #%transient-key -- but not implemented in gnupg!
         %no-ask-passphrase
         Key-Type: RSA
         Name-Real: Example Key
         Name-Comment: N/A
         Name-Email: [email protected]
         Expire-Date: 2d
         Preferences: (setpref)
         %commit
         """)
     finally:
         f.close()
     base._run_cmd(
         ['gpg', '--gen-key', '--batch', config_file], tempdir.path)
Exemple #11
0
 def setUp(self):
     super(GPGKeyFixture, self).setUp()
     tempdir = self.useFixture(fixtures.TempDir())
     config_file = tempdir.path + '/key-config'
     f = open(config_file, 'wt')
     try:
         f.write("""
         #%no-protection -- these would be ideal but they are documented
         #%transient-key -- but not implemented in gnupg!
         %no-ask-passphrase
         Key-Type: RSA
         Name-Real: Example Key
         Name-Comment: N/A
         Name-Email: [email protected]
         Expire-Date: 2d
         Preferences: (setpref)
         %commit
         """)
     finally:
         f.close()
     # Note that --quick-random (--debug-quick-random in GnuPG 2.x)
     # does not have a corresponding preferences file setting and
     # must be passed explicitly on the command line instead
     gnupg_version_re = re.compile('gpg .* ([12])\.')
     gnupg_version = base._run_cmd(['gpg', '--version'], tempdir.path)
     for line in gnupg_version[0].split('\n'):
         gnupg_version = gnupg_version_re.match(line)
         if gnupg_version:
             gnupg_version = gnupg_version.group(1)
             break
     if gnupg_version == '1':
         gnupg_random = '--quick-random'
     elif gnupg_version == '2':
         gnupg_random = '--debug-quick-random'
     else:
         gnupg_random = ''
     base._run_cmd(
         ['gpg', '--gen-key', '--batch', gnupg_random, config_file],
         tempdir.path)
 def commit(self, message_content="test commit"):
     files = len(os.listdir(self._basedir))
     path = self._basedir + "/%d" % files
     open(path, "wt").close()
     base._run_cmd(["git", "add", path], self._basedir)
     base._run_cmd(["git", "commit", "-m", message_content], self._basedir)
Exemple #13
0
 def tag(self, version):
     base._run_cmd(
         ['git', 'tag', '-sm', 'test tag', version], self._basedir)
Exemple #14
0
 def uncommit(self):
     base._run_cmd(['git', 'reset', '--hard', 'HEAD^'], self._basedir)
Exemple #15
0
 def commit(self, message_content='test commit'):
     files = len(os.listdir(self._basedir))
     path = self._basedir + '/%d' % files
     open(path, 'wt').close()
     base._run_cmd(['git', 'add', path], self._basedir)
     base._run_cmd(['git', 'commit', '-m', message_content], self._basedir)
Exemple #16
0
 def setUp(self):
     super(TestRepo, self).setUp()
     base._run_cmd(['git', 'init', '.'], self._basedir)
     base._config_git()
     base._run_cmd(['git', 'add', '.'], self._basedir)
 def uncommit(self):
     base._run_cmd(['git', 'reset', '--hard', 'HEAD^'], self._basedir)
 def setUp(self):
     super(TestRepo, self).setUp()
     base._run_cmd(['git', 'init', '.'], self._basedir)
     base._config_git()
     base._run_cmd(['git', 'add', '.'], self._basedir)
 def setUp(self):
     super(TestRepo, self).setUp()
     base._run_cmd(["git", "init", "."], self._basedir)
     base._config_git()
     base._run_cmd(["git", "add", "."], self._basedir)
Exemple #20
0
 def commit(self):
     base._run_cmd(['git', 'commit', '-m', 'test commit'], self._basedir)
Exemple #21
0
 def commit(self):
     base._run_cmd(['git', 'commit', '-m', 'test commit'], self._basedir)
 def commit(self, message_content='test commit'):
     files = len(os.listdir(self._basedir))
     path = self._basedir + '/%d' % files
     open(path, 'wt').close()
     base._run_cmd(['git', 'add', path], self._basedir)
     base._run_cmd(['git', 'commit', '-m', message_content], self._basedir)
 def uncommit(self):
     base._run_cmd(["git", "reset", "--hard", "HEAD^"], self._basedir)
 def tag(self, version):
     base._run_cmd(
         ['git', 'tag', '-sm', 'test tag', version], self._basedir)
 def tag(self, version):
     base._run_cmd(["git", "tag", "-sm", "test tag", version], self._basedir)