Beispiel #1
0
    def configure(self):
        if self.provide_itself:
            self.provide('sshkeypair', self)

        self += Directory('~/.ssh', mode=0o700)

        # RSA
        if self.id_rsa:
            self += File('~/.ssh/id_rsa',
                         content=self.id_rsa,
                         mode=0o600)
        elif self.purge_unmanaged_keys:
            self += Purge('~/.ssh/id_rsa')

        if self.id_rsa_pub:
            self += File('~/.ssh/id_rsa.pub',
                         content=self.id_rsa_pub)

        # ED25519
        if self.id_ed25519:
            self += File('~/.ssh/id_ed25519',
                         content='{}\n'.format(self.id_ed25519),
                         mode=0o600)

        elif self.purge_unmanaged_keys:
            self += Purge('~/.ssh/id_ed25519')

        if self.id_ed25519_pub:
            self += File('~/.ssh/id_ed25519.pub',
                         content=self.id_ed25519_pub)

        # ScanHost
        for host in self.scan_hosts:
            self += ScanHost(host)
Beispiel #2
0
def test_purge_globs_and_deletes_tree(root):
    os.mkdir("work/mycomponent/source")
    open("work/mycomponent/source/one", "w").close()
    open("work/mycomponent/source/two", "w").close()
    root.component += Purge("sourc*")
    root.component.deploy()
    assert sorted(os.listdir("work/mycomponent")) == []
Beispiel #3
0
def test_purge_globs_and_deletes_tree(root):
    os.mkdir('work/mycomponent/source')
    open('work/mycomponent/source/one', 'w').close()
    open('work/mycomponent/source/two', 'w').close()
    root.component += Purge('sourc*')
    root.component.deploy()
    assert sorted(os.listdir('work/mycomponent')) == []