Add a few more scripts
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
vault-token.txt
 | 
			
		||||
							
								
								
									
										38
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
# Documeent on these scripts
 | 
			
		||||
 | 
			
		||||
## Arif's lab specific
 | 
			
		||||
 | 
			
		||||
`fix_cloud_focal.sh`
 | 
			
		||||
`fix_cloud.sh`
 | 
			
		||||
 | 
			
		||||
## Generic scripts
 | 
			
		||||
 | 
			
		||||
`check_juju.sh`
 | 
			
		||||
 | 
			
		||||
Does a `juju status` anc discards active, idle units htat are green
 | 
			
		||||
 | 
			
		||||
`check_mongo.sh`
 | 
			
		||||
 | 
			
		||||
logs into a juju controller directly onto mongodb, below are the 2 arguments that will be taken
 | 
			
		||||
 | 
			
		||||
1. machine-id (0)
 | 
			
		||||
1. model-name (controller)
 | 
			
		||||
 | 
			
		||||
`check_queues.sh`
 | 
			
		||||
 | 
			
		||||
checks to see if the queues are balanced on all juju controllers.
 | 
			
		||||
 | 
			
		||||
	`check_vip_issue_db.sh`
 | 
			
		||||
debug-relations.sh
 | 
			
		||||
get_all_ips.sh
 | 
			
		||||
get_all_relation_info.sh
 | 
			
		||||
get_charm_versions.sh
 | 
			
		||||
get_details.sh
 | 
			
		||||
get_passwords.sh
 | 
			
		||||
get_relation_info.py
 | 
			
		||||
grab_vips.sh
 | 
			
		||||
reset.sh
 | 
			
		||||
test_juju.py
 | 
			
		||||
vault_init.sh
 | 
			
		||||
vault.sh
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								check_mongo2.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										18
									
								
								check_mongo2.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
machine=${1:-0}
 | 
			
		||||
model=${2:-controller}
 | 
			
		||||
 | 
			
		||||
read -d '' -r cmds <<'EOF'
 | 
			
		||||
user=$(sudo ls /var/lib/juju/agents/)
 | 
			
		||||
conf=/var/lib/juju/agents/${user}/agent.conf
 | 
			
		||||
password=$(sudo grep statepassword ${conf} | cut -d' ' -f2)
 | 
			
		||||
if [ -f /usr/lib/juju/mongo*/bin/mongo ]; then
 | 
			
		||||
  client=/usr/lib/juju/mongo*/bin/mongo
 | 
			
		||||
else
 | 
			
		||||
  client=/usr/bin/mongo
 | 
			
		||||
fi
 | 
			
		||||
${client} 127.0.0.1:37017/juju --authenticationDatabase admin --ssl --sslAllowInvalidCertificates --username "${user}" --password "${password}" --eval "rs.status()" | grep -P '(name|stateStr)'
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
juju ssh -m ${model} ${machine} "${cmds}"
 | 
			
		||||
							
								
								
									
										36
									
								
								test_juju.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										36
									
								
								test_juju.py
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
 | 
			
		||||
import asyncio
 | 
			
		||||
 | 
			
		||||
from juju.controller import Controller
 | 
			
		||||
from juju.client.connection import Connection
 | 
			
		||||
from juju.client.client import ClientFacade
 | 
			
		||||
 | 
			
		||||
async def _this_get_model():
 | 
			
		||||
    controller = Controller()
 | 
			
		||||
    endpoint="10.0.1.226:17070"
 | 
			
		||||
    cacert_path="/home/arif/gitRepos/useful_scripts/controller_cert.crt"
 | 
			
		||||
    cacert=open(cacert_path,'r').read()
 | 
			
		||||
    model_uuid="8d65d934-7527-4a72-8774-941bf2be4cc2"
 | 
			
		||||
    password="hello123"
 | 
			
		||||
    username="admin"
 | 
			
		||||
    #max_frame_size=8388608
 | 
			
		||||
    max_frame_size=4194304
 | 
			
		||||
 | 
			
		||||
    conn = await Connection.connect(endpoint=endpoint, uuid=model_uuid,
 | 
			
		||||
                        cacert=cacert, username=username,
 | 
			
		||||
                        password=password, max_frame_size=max_frame_size)
 | 
			
		||||
 | 
			
		||||
    client = ClientFacade.from_connection(conn)
 | 
			
		||||
    patterns = None
 | 
			
		||||
    status = await client.FullStatus(patterns)
 | 
			
		||||
 | 
			
		||||
    print(status)
 | 
			
		||||
 | 
			
		||||
    await conn.close()
 | 
			
		||||
 | 
			
		||||
async def main():
 | 
			
		||||
    await _this_get_model()
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    asyncio.run(main())
 | 
			
		||||
		Reference in New Issue
	
	Block a user