vm-tool 1.0.13__tar.gz → 1.0.15__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: vm_tool
3
- Version: 1.0.13
3
+ Version: 1.0.15
4
4
  Summary: A Comprehensive Tool for Setting Up Virtual Machines Using Ansible.
5
5
  License: MIT
6
6
  Description-Content-Type: text/markdown
@@ -11,7 +11,7 @@ else:
11
11
 
12
12
  setup(
13
13
  name='vm_tool',
14
- version='1.0.13', # This will be updated by bump2version
14
+ version='1.0.15', # This will be updated by bump2version
15
15
  packages=find_packages(),
16
16
  description='A Comprehensive Tool for Setting Up Virtual Machines Using Ansible.',
17
17
  long_description=long_description,
@@ -2,7 +2,7 @@ import argparse
2
2
 
3
3
  def main():
4
4
  parser = argparse.ArgumentParser(description='Setup VMs using Ansible.')
5
- parser.add_argument('--version', action='version', version='1.0.13')
5
+ parser.add_argument('--version', action='version', version='1.0.15')
6
6
 
7
7
  args = parser.parse_args()
8
8
 
@@ -32,7 +32,7 @@ class SSHSetup:
32
32
  self.client = paramiko.SSHClient()
33
33
  self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
34
34
 
35
- def generate_ssh_key(self, email):
35
+ def __generate_ssh_key(self, email):
36
36
  """
37
37
  Generates an SSH key pair.
38
38
 
@@ -42,7 +42,7 @@ class SSHSetup:
42
42
  print(f"Generating SSH key for email: {email}")
43
43
  os.system(f'ssh-keygen -t rsa -b 4096 -C "{email}"')
44
44
 
45
- def read_or_generate_public_key(self, email):
45
+ def __read_or_generate_public_key(self, email):
46
46
  """
47
47
  Reads the public SSH key or generates a new one if it doesn't exist.
48
48
 
@@ -54,12 +54,12 @@ class SSHSetup:
54
54
  """
55
55
  public_key_path = f'{self.private_key_path}.pub'
56
56
  if not os.path.exists(public_key_path):
57
- self.generate_ssh_key(email)
57
+ self.__generate_ssh_key(email)
58
58
  with open(public_key_path, 'r') as file:
59
59
  print(f"Reading public key from {public_key_path}")
60
60
  return file.read()
61
61
 
62
- def configure_vm(self, vm_ip, vm_password, public_key):
62
+ def __configure_vm(self, vm_ip, vm_password, public_key):
63
63
  """
64
64
  Configures the VM by adding the public SSH key to the authorized keys.
65
65
 
@@ -73,7 +73,7 @@ class SSHSetup:
73
73
  self.client.exec_command(f'echo "{public_key}" >> ~/.ssh/authorized_keys')
74
74
  self.client.close()
75
75
 
76
- def update_ssh_config(self):
76
+ def __update_ssh_config(self):
77
77
  """
78
78
  Updates the local SSH config file with the VM details.
79
79
  """
@@ -89,14 +89,14 @@ Host {self.hostname}
89
89
  with open(f'{os.path.expanduser("~")}/.ssh/config', 'a') as file:
90
90
  file.write(config)
91
91
 
92
- def establish_connection(self):
92
+ def __establish_connection(self):
93
93
  """
94
94
  Establishes an SSH connection to the VM.
95
95
  """
96
96
  print(f"Establishing SSH connection to {self.hostname}.")
97
97
  self.client.connect(self.hostname, username=self.username, key_filename=self.private_key_path)
98
98
 
99
- def close_connection(self):
99
+ def __close_connection(self):
100
100
  """
101
101
  Closes the SSH connection.
102
102
  """
@@ -109,9 +109,9 @@ Host {self.hostname}
109
109
  Sets up the SSH configuration and keys for the VM.
110
110
  """
111
111
  print("Starting SSH setup.")
112
- public_key = self.read_or_generate_public_key(self.email)
113
- self.configure_vm(self.hostname, self.password, public_key)
114
- self.update_ssh_config()
115
- self.establish_connection()
116
- self.close_connection()
112
+ public_key = self.__read_or_generate_public_key(self.email)
113
+ self.__configure_vm(self.hostname, self.password, public_key)
114
+ self.__update_ssh_config()
115
+ self.__establish_connection()
116
+ self.__close_connection()
117
117
  print("SSH setup completed.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: vm_tool
3
- Version: 1.0.13
3
+ Version: 1.0.15
4
4
  Summary: A Comprehensive Tool for Setting Up Virtual Machines Using Ansible.
5
5
  License: MIT
6
6
  Description-Content-Type: text/markdown
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes