Skip to content

Commit

Permalink
Remove more hardcoding
Browse files Browse the repository at this point in the history
  • Loading branch information
cholcombe973 committed Sep 19, 2017
1 parent 587e82b commit dc8e84d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ information. Edit the `/etc/ceph_dead_disk/config.json` file to configure it. F
```
{
"ceph_config": "/etc/ceph/ceph.conf",
"ceph_user_id": "admin"
"ceph_user_id": "admin",
"db_location": "/etc/ceph_dead_disk/disks.sqlite3",
"jira_user": "test_user",
"jira_password": "user_password",
"jira_host": "https://tickets.jira.com",
"jira_ticket_assignee": "username",
"jira_issue_type": "3",
"jira_priority": "4",
"jira_project_id": "MyProject",
"jira_ticket_assignee": "assignee_username"
}
```

Expand Down
10 changes: 1 addition & 9 deletions src/backend/ceph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,7 @@ impl CephBackend {
}

// Format the osd with the osd filesystem
debug!("Running ceph-osd --mkfs");
if !simulate {
Command::new("ceph-osd")
.args(&["-i", &new_osd_id.to_string(), "--mkfs", "mkkey"])
.output()
.expect("Failed to run ceph-osd mkfs");
}
ceph_mkfs(new_osd_id, None, simulate)?;
debug!("Creating ceph authorization entry");
auth_add(self.cluster_handle, new_osd_id, simulate)?;
let auth_key = auth_get_key(self.cluster_handle, new_osd_id, simulate)?;
Expand Down Expand Up @@ -389,8 +383,6 @@ fn add_osd_to_fstab(
simulate: bool,
) -> Result<(), String> {
let fstab = FsTab::default();
let entries = fstab.get_entries().map_err(|e| e.to_string())?;

let fstab_entry = fstab::FsEntry {
fs_spec: format!("UUID={}",
device_info.id
Expand Down
4 changes: 2 additions & 2 deletions src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod ceph;
//pub mod gluster;

use std::io::Result;
use std::path::{Path, PathBuf};
use std::path::Path;
use std::result::Result as StdResult;

use self::ceph::CephBackend;
Expand Down Expand Up @@ -39,7 +39,7 @@ pub fn load_backend(
//#[cfg(feature = "gluster")]
//&BackendType::Gluster => Box::new(GlusterBackend::new(config_dir)
//.map_err(|e| e.to_string())?),
e => return Err(format!("Unknown backend: {:?}", e)),
//e => return Err(format!("Unknown backend: {:?}", e)),
};

Ok(backend)
Expand Down
12 changes: 8 additions & 4 deletions src/create_support_ticket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,24 @@ pub fn create_support_ticket(
host: &str,
user: &str,
pass: &str,
issue_type: &str,
priority: &str,
project_id: &str,
assignee: &str,
title: &str,
description: &str,
environment: &str,
) -> Result<String, GojiError> {
let issue_description = CreateIssue {
fields: Fields {
assignee: Assignee { name: "Cloud_Services_Storage_SRE".to_string() },
assignee: Assignee { name: assignee.into() },
components: vec![Component { name: "Ceph".into() }],
description: description.into(),
environment: environment.into(),
issuetype: IssueType { id: "3".into() },
issuetype: IssueType { id: issue_type.into() },
reporter: Assignee { name: user.to_string() },
priority: Priority { id: "4".into() },
project: Project { key: "PLATINF".into() },
priority: Priority { id: priority.into() },
project: Project { key: project_id.into() },
summary: title.into(),
},
};
Expand Down
8 changes: 8 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ struct ConfigSettings {
jira_user: String,
jira_password: String,
jira_host: String,
jira_issue_type: String,
jira_priority: String,
jira_project_id: String,
jira_ticket_assignee: String,
}

fn load_config(config_dir: &str) -> Result<ConfigSettings, String> {
Expand Down Expand Up @@ -95,6 +99,10 @@ Details: Disk {} as failed. Please replace if necessary",
&config.jira_host,
&config.jira_user,
&config.jira_password,
&config.jira_issue_type,
&config.jira_priority,
&config.jira_project_id,
&config.jira_ticket_assignee,
"Dead disk",
&description,
&environment,
Expand Down

0 comments on commit dc8e84d

Please sign in to comment.